Conditional Structures
Operator
Description
Example
Conditional Tests
if — then
if 2 + 3 == 5 then
print("Two plus three is five")
endlocal nilVariable -- Variable is declared but has no value, so it's nil
local falseVariable = false -- Variable is declared with value of false
if nilVariable ~= true then
print(nilVariable) -- Outputs "nil" since nil is not true
end
if falseVariable ~= true then
print(falseVariable) -- Outputs "false" since false is not true
endelseif — then
else
Conditional Loops
while — do
repeat — until
Using Logical Operators
Multi-Condition Tests
Non-Truth Tests
Last updated
Was this helpful?
