lua-users home
lua-l archive

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


Now that we have a "break" statement, you can eliminate the duplicate
assignment by doing this:

while 1 do
    c = f()
    if c == 1 then break end
    print(c)
end


-----Original Message-----
From: Steve Williams
Sent: Thursday, January 11, 2001 12:56 PM
Subject: Re: assignments in expressions?

What is wrong with this way?  It is no different in functionality and easier
to understand.

c = f()
while c == 1 do
  print(c)
  c = f()
end