4 ms·
I still don’t get why people would want to type ‘:=‘ instead of just ‘=‘, but okay.
by hartator 4y ago
I still don’t get why people would want to type ‘:=‘ instead of just ‘=‘, but okay.
- 62951413 4y agoTurbo Pascal FTW!
- cardanome 4y agoConfusion between '=' and '==' is a typical pain point that beginners have when learning to program. Plus it is super at odds with the notation we all learn in math. ':=' is didactically better because it shows that assignment has an direction. It also leaves '=' for actual equality.
- pharmakom 4y agoBig fan of <- for assignment for this reason.
- bmitc 4y agoF#!
- garethrowlands 4y agoTurns out, a few slides later, that ':=' doesn't have direction; it's merely a contraction of declaration, ':', and equality, '='. So 'x := 3' means the same as 'x:int; x=3'. Perhaps more surprisingly, so does, 'x=3; x:int'.
- skitter 4y agoI guess it's not strictly necessary to require a ':', but it tells people that a new variable is getting defined, instead of an existing one getting narrowed.