Control Structures

Lua has a full complement of looping and conditional structures, similar to Pascal and C. The condition expression EXP1of a control structure may return any single value.

All values different from nil are considered true; only nil is considered false.

while EXP1 do BLOCK end
repeat BLOCK until EXP
if EXP1 then BLOCK
  { elseif EXP1 then BLOCK }
  [ else BLOCK ]
end