News for hackers. Stuff that matters.
Re:Flappy Bird in Swift by josephlord on Tuesday June 03, 2014 @09:50PM (#7843629)

  if var == true {...}
In some languages var might be truthy but not equal to true. The falsy values may be more of a problem at times.

However in the strongly typed swift I don't think it will be a problem as I suspect (but haven't read/tested enough yet to confirm) that only false and nil will be falsy and that comparison with true will throw errors if var isn't of bool type.

Re:Flappy Bird in Swift by josephlord on Wednesday June 04, 2014 @08:01AM (#7845050)
Just tried it. In Swift:

  3 == true    // Give an error (operator overload doesn't cover this)
  true == 3    // Returns false
  nil == false // Returns false
You can't use nil or integers directly in an if statement without a function to return a logic value.
Re:Flappy Bird in Swift by anon4 on Saturday June 07, 2014 @05:07PM (#7863105)
Yes, such languages exist, and even in C++ if (x == true) is different from if (x), given that x is any number kind other than boolean, but my comment was only for the case when the two would be equivalent.