53
Comments
  • 0
    I dont get it. How did the bool change??!
  • 10
    Observe the if statement carefully
  • 6
    @linuxer4fun probably because there's only one `=` which get's interpreted as assignment. In most languages to compare you have to use `==`. There are some (like PHP) which even use `===` for a comparisation with type checking.

    In mathematics (and a few languages) you use `:=` for assignment and `=` for comparision (<-- is that a proper english word?)
  • 0
    @pascalwacker pascal user 2??😂
  • 0
    @pascalwacker I believe it's comparison
  • 1
    Yeah, with only one = you say assign isCrazyRobot true, and because there is no further comparison, the whole statement is true
  • 0
    @pascalwacker mmm strict equality. Tasty.
  • 0
    And that static bool means it applies to all the robots not just one instance of a robot
  • 0
    This mistake will one day destroy the earth...
  • 0
    @Rabb static in C for a global variable means it's not visible in other c files nor in the header (if I remember correctly, static keyword is said to be the most confusing one in C,C++)
Add Comment