Lua-like variable assignment depending on condition

You’re looking for the Ternary Operator

var x = val1 if condition else val2

1 Like