Comment by SeanDav

Comment by SeanDav 4 hours ago

2 replies

It is not a lie it is just apparently familiar notation that actually has an entirely different meaning. It is not an equation, it is an assignment.

X := X + 1 is perhaps less confusing, even if meaning the same thing.

sodapopcan 27 minutes ago

Although in Erlang it's closer to an equation with assignment being a side effect. `=` is the pattern matching operator.

    Eshell V15.2.6 (press Ctrl+G to abort, type help(). for help)
    1> X = 1.
    1
    2> X = X.
    1
    3> 1 = X.
    1
    4> X = 2.
    ** exception error: no match of right hand side value 2
    5>
npteljes 3 hours ago

That's exactly right. Looking at the Assignment Operator Wiki page, it's also clear where these notations come from.

I think an easy way to look at it, for someone coming from a math background, is to think of programming lines as instructions, instead of statements. x=x+1 can be then read as "let x be x+1", and that's it.

https://en.wikipedia.org/wiki/Assignment_(computer_science)