This could be helpful for verifying calculations, e.g. expression == my_answer to validate manual calculations.
A more controversial syntax (but arguably, closer to actual math syntax) might overload the = operator, so
x = 4 # x was not used before, so it is an assignment
x = 2 + 2 # assertion is true, nothing happens
x = 2 + 3 # Error: x is not equal to 5
y = 8 / 2 # y was not used before, assign
x = y # get x and y and assert to compare for equality
It would be great to have assertions, so it would be possible to do
This could be helpful for verifying calculations, e.g.
expression == my_answer
to validate manual calculations.A more controversial syntax (but arguably, closer to actual math syntax) might overload the
=
operator, soSo the above would work in a similar way on how
=
operator works in Erlang or Elixir, see https://learnyousomeerlang.com/starting-out-for-real#invariable-variablesHaving the above would also help to get rid of accidental overwrites like
If forced assignment would be needed, there's the
:=
symbol commonly used in math for it.