lua-users home
lua-l archive

Re: question about 0 as exp in repeat-until

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Jan 21, 2010 at 8:34 AM, Joseph Stewart
<joseph.stewart@gmail.com> wrote:
> "while 0" is the same thing as saying "while true" (meaning loop forever or
> until "break"), by the same rule "until 0" is the same thing as saying
> "until true" which means only one pass through the loop.
Yes, old C habits die hard ;) Only nil or false fail as conditions.
(In Python, to give an example of an idea gone a little mad, empty
strings and empty lists are also considered 'false', but a list
containing an empty string is not (this is called 'falseness does not
nest').)
steve d.

AltStyle によって変換されたページ (->オリジナル) /