Expressions in Dinky are anything that returns a single value. They can be as simple as
2 or
a+100 or more complex operations like
a+((5/2)*10) and
a ? 10 : 20.
Expressions can be assigned to variables or passed to functions.
local a = 67*6
setScore(hits*100)
Expressions perform what is called
const folding. If you write
10+9 the compiler will emit
19. You can do complex math operations at run-time without fear of performance issues. If you do
a+9*10 the compile will generate
a+90.
Copyright 2020 Terrible Toybox, Inc. All Rights Reserved.