Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

  > I guess you mean the opposite hasn't
  > prevented Ruby from being popular.
I was stating something more like "the fact that there is a hard split between numbers and booleans, and everything -- barring null -- by default evaluates to true." Since everything is a object instance in Ruby, asserting a variable is basically only evaluating whether or not it is null.


null or false, actually.


Slip of the tongue. ;) But the easiest way to think about it is something like:

  type(x) == Boolean ? x == True : x != nil
Disclaimer: That may not be valid Ruby, as I only have a passing knowledge of some bits of Ruby.




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

Search: