2 ms·
a = 11 if a = 10 Great way to set someone up for failure when they switch to any C-like language! I personally have experienced people finding it easier to
by amenghra 8y ago
a = 11
if a = 10
Great way to set someone up for failure when they switch to any C-like language!
I personally have experienced people finding it easier to grasp a construct such as a := 1 or let a = 1. The way most programming languages assign values to variables conflicts with the notion of equations, which is familiar to a lot of people by the time they learn to write programs.
- musicale 8y agoPerhaps it's C that is weird for confusingly allowing you to assign within a logical expression. At least clang (and possibly other compilers) warn you because they assume you meant to write '=='. (Dartmouth BASIC required a LET keyword, Kemeny and Kurtz being mathematicians after all. Bill Gates might have made it optional in Microsoft BASIC to save typing and possibly one byte of memory.) I sort of miss Smalltalk's left-arrow though.