this post was submitted on 22 Nov 2023
278 points (98.9% liked)
196
16744 readers
1812 users here now
Be sure to follow the rule before you head out.
Rule: You must post before you leave.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Ruby has a method for this :)
In Ruby,
0
and""
is truthy, so this would be a little different than the Python interpretation. You could filter with #select, but you'd typically write your code around this instead.What the fuck?
Lua is the same. Only
false
andnil
are "falsey".I remember I fixed a bug in a mod for Minetest that assumed
0
was false and caused an infinite loop.