{ {type='rows', default={font={size=21}, line_height=35}, {type='text', font={size=28}, line_height=50, {'Lua@{Lua} > expressions', attrs={ Lua={target='--lua'}, }}, }, {type='filler', height=15}, {type='text', {'Anywhere in a statement you might use (not define) a variable, you can use an em@{expression} in its place. Some examples:', attrs={ em={font={italic=true}}}}}, {type='text', '5', font={size=24}}, {type='text', ' All values (numbers, strings, tables, etc.) are types.'}, {type='filler', height=10}, {type='text', '5+3', font={size=24}}, {type='text', ' You can add (+), subtract (-), multiply (*), divide (/), compute the remainder (%) of two numbers.'}, {type='filler', height=10}, {type='text', '4+3*2', font={size=24}}, {type='text', ' Expressions can contain other expressions, and they follow the precedence rules you learned in school.'}, {type='text', ' Multiplication, division and remainder happen before addition and subtraction.'}, {type='filler', height=10}, {type='text', '(4+3) * 2'}, {type='text', ' To ensure one expression is calculated before another, use parentheses ()'}, {type='filler', height=10}, {type='text', 'x == y'}, {type='text', " You can compare two expressions to determine if they're equal (==), not equal (~=), greater (>), lesser (<), greater or equal (>=), lesser or equal (<=)."}, {type='text', " These expressions are handy in the conditions of 'if' statements and loops."}, {type='filler', height=10}, {type='text', 'x == 3 and y > 4', font={size=24}}, {type='text', {' Comparisons return em@{booleans} true or false, which can be combined using and/or.', attrs={ em={font={italic=true}}}}}, {type='filler', height=10}, {type='text', 'not x == 3', font={size=24}}, {type='text', ' Turn a boolean into its opposite.'}, {type='filler', height=10}, {type='text', 'nil or 3', font={size=24}}, {type='text', ' All non-boolean values act like true in and/or except for nil.'}, {type='filler', height=10}, {type='text', '"hello ".."world"', font={size=24}}, {type='text', ' String values can be combined using ..'}, {type='filler', height=10}, {type='text', 'add(2, 3)', font={size=24}}, {type='text', ' Function calls can act as expressions as well as statements.'}, } }