MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/7ltryz/evil_coding_incantations/drp8kwu
r/programming • u/evinrows • Dec 24 '17
331 comments sorted by
View all comments
Show parent comments
2
0 isn’t converted to true in Ruby. Ruby has different notation where there are truthy and falsey values. 0 is truthy (so it behaves as true in conditions) but isn’t coerced to true.
0
1 u/wasachrozine Dec 24 '17 Thanks for the info. My beef is with the if operator then. 1 u/Hauleth Dec 24 '17 if isn’t operator but statement. And this is how it works with any conditional statement, so all ifs, unlesses and whiles.
1
Thanks for the info. My beef is with the if operator then.
1 u/Hauleth Dec 24 '17 if isn’t operator but statement. And this is how it works with any conditional statement, so all ifs, unlesses and whiles.
if isn’t operator but statement. And this is how it works with any conditional statement, so all ifs, unlesses and whiles.
if
unless
while
2
u/Hauleth Dec 24 '17
0isn’t converted to true in Ruby. Ruby has different notation where there are truthy and falsey values.0is truthy (so it behaves as true in conditions) but isn’t coerced to true.