Lua Process Control
Lua programming language flow control statements be programmed with one or more conditional statement to set. Executes the specified program code if the condition is true, execute other code is specified in the condition is false.
The following is a typical process control flow chart:
Conditional expression control structure can be any value, Lua considered false and nil as false, true and non-nil is true.
It should be noted Lua 0 is true:
--[ 0 为 true ] if(0) then print("0 为 true") end
The above code output is:
0 为 true
Lua control structure provides the following statement:
|if statement||if statement consists ofa Boolean expression as a condition to judge, immediately followed by other statements.|
|if ... else statement||if and elsestatements canbeused withthe statement,the else statement is false in the code if the conditional expression.|
|if nested statements||You can use one or more ofif or else ifstatementiforelse ifthe.|