July 2018
Beginner
202 pages
5h 42m
English
A logical control structure always starts with an if statement. As described previously, an if statement consists of the if keyword, a Boolean expression, and a then/end chunk. The then/end chunk is only executed when the Boolean condition evaluates to true. The following code sample demonstrates the basic use of an if statement:
print ("Enter your name")name = io.read()if #name <= 3 then print ("that's a short name, " .. name)end