Control structures are used to make decisions in code; they control the path of code based on a Boolean value. Lua provides the if statement for this purpose. An if statement is followed by a Boolean condition, which in turn is followed by a then/end chunk. The chunk is only executed when the Boolean condition evaluates to true.
The most basic syntax of an if statement is as follows:
![](https://static.packt-cdn.com/products/9781789343229/graphics/assets/1440be89-c865-4f28-ba3c-2925c3371468.png)