Hacker News new | past | comments | ask | show | jobs | submit login

x = x + 1

I remember the fist time I saw that line and said, that's false. And it's been an ever ending divergence from pure math for the past 30 years.




It can also be:

x <- x + 1

x := x + 1

But I guess since assignment is more frequent than equality checks, most PL designers opt for using equals. I do like R's left arrow assignment operator. If only keyboards had a default arrow character key. It would completely get rid of a class of errors based on forgetting the second equals sign.


A sane compiler always give a warning when doing a comparison outside a condition and when doing an assignment within a condition.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: