Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
snorkel
on June 5, 2012
|
parent
|
context
|
favorite
| on:
New to Ruby? Tips for the new Rubyist.
Empty string is true. Who here hasn't banged their head over that one?
getsat
on June 5, 2012
|
next
[–]
It's probably better to think "everything that isn't
nil
or
false
is true".
xentronium
on June 5, 2012
|
prev
[–]
0 is true too. I think that's actually brilliant.
[1,2,3].index(1) # => 0 [1,2,3].index(4) # => nil
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: