Getting started with Lua (Part 3)
Basic Programming Constructs — Level 2 (conditional statements)
Note : Click here for Part 1 and Part 2
In this piece we will cover the simplest programming construct; a conditional statement and also get introduced to some core concepts in Lua.
- if-else condition
2. if -else if-else conditional blocks
if-else
The basic syntax for if-else and if-else
conditional blocks are as shown below
if-else if — else
An extended if-else block is where you can specify multiple conditional statements in your code block as shown below
Lua Concepts and terms
Lets talk about 3concepts in Lua. We will look into more concepts later on.
1. Chunk
Each piece of code in lua is called a chunk. It just a name to refer to a sequence of statements of code. Nothing more.
It could be an entire program in a code , a function or just a few lines of code. Its just a naming.