Why not use the Pascal trick (inherited from ALGOL) of distinguishing an assignment ( x := y ) from a comparison ( if ( x = y) )?
in C, "x = x + 1;" is clearly arithmetically nonsensical.
at school you're taught that = is part of an equation ( left side of = sign is identical to right hand side)
( if ( x = y) )
Here both sides of the = may or may not be identical.
Personally I have never had any problem understanding the x = x + 1 construction
in a system with no declaration types and no semicolons this converts into:
or the C trick of distinguishing an assignment ( x = y ) from a comparison ( if ( x == y) )?
Why wouldn't you treat the end-of-line as the end of a statement if there is no semi-colon?It is possible to have continuation character for the odd occasions when code needs to run on to a second line.Indeed, if semi-colons don't matter why not just run over the code and delete them and always use the EOL as the delimiter....R
int a = 1, b = 2, c = 3
Especially where : needs a Shift press too.
= // assignment== // check
:= // or..int x = .. // assignment== // check
= // both assignment and equality check
bool isPressed = (reading = 3) // orbool isPressed = isOn = 1 // etc.
Two symbols are two symbols, I have no problem with ==.At the same time, context within an if( ) makes sense too, I've never written anything where I assigned a value within an if ( ) statement, that is just too convoluted for me. Write it as two lines, let the compiler deal with it.