3 ms·
That's just because the above code is in Pascal. You see, it would be much more complicated if written in C++ or distributed real-time Java.
by imagine99 6y ago
That's just because the above code is in Pascal. You see, it would be much more complicated if written in C++ or distributed real-time Java.
- martin_a 6y agoI was _so_ freaked out by that one equal sign. Pascal uses := for assignments, if I remember correctly?
- deleted 6y ago[deleted]
- imagine99 6y agoThat is correct, but for boolean expressions, logical operators etc. it's just the one equal sign. E.g. if pilot.sleeping = true then alarm.playing := true; // This will check if the property "sleeping" of pilot is true and will then set the property "playing" of alarm to true as well. You could also do a "while" or "repeat .. until" there which would probably better to stop the alarm if the pilot wakes up again (... then alarm.playing := false). It could totally work this way if you programmed a simple flight simulator with Delphi, even today. BTW, one exception to := in assignments are initialized variables inside a var section: var announcement: string = 'Wake up!';
- leetcrew 6y agosad that this didn't catch on more broadly. I find that the difference between `=` and `==` is consistently confusing to beginners. it's actually worse when someone has a strong math background. that and the fact that `1/2 * x` is zero in most languages...
- imagine99 6y agoFully agree. This is why I still argue even today that (Object) Pascal aka. Delphi is a wonderful language and tool for beginners and casual programmers who want to get things done quickly and (somewhat) intuitively. Delphi unfortunately is not very en vogue at the moment due to misguided and community-destroying licensing policies by the company that owns it. But that's no fault of the language and the toolset. Both together make one the most mature, flexible and easily accessible environments for programming that I've ever encountered, from quick & simple UI-driven cross-platform apps to Web backends to hardware-oriented IoT stuff with a little Assembly sprinkled in. Of course there is FreePascal and Lazarus and all that if you really want to play with Pascal without touching Delphi. Both are neat, even though Delphi is also now available as a free community edition. What I'm saying is: Go forth and write more `:=`
- beaconstudios 6y agoThere would be curly braces and everything!