User talk:Gechy/lua tutorial

if/else as an expression
One of the commonest uses of logical and/or is to make a compact if ... then ... elseif ... end statement (make sure you write elseif, not else if).

Assigning x to one of a number of values a, b, c, ... y, z, depending on the value of a variable val can be done traditionally:

Optionally, it can be written: Note that the latter is a single statement, but I've spread it out over several lines to emphasise the parallel between the two methods. --RexxS (talk) 21:52, 15 January 2021 (UTC)