18 ms·
Only nil and false evaluate to false. Because there's no distinction between nil and non-existent elements, checking the existence of an element with a value of
by vor_ 14y ago
Only nil and false evaluate to false. Because there's no distinction between nil and non-existent elements, checking the existence of an element with a value of 0 requires that 0 evaluates to true, so you get this situation:
while 0 do print("loops forever") end
while not 0 do print("does nothing") end
- spicyj 14y agoWhat you're saying is just that in Lua, 0 is truthy. Ruby is the same way, not a big deal.