rhai/scripts/if2.rhai
2022-01-20 12:06:36 +08:00

13 lines
183 B
JavaScript

// This script runs an if expression.
let a = 42;
let b = 123;
let x = if a <= b { // <- if-expression
b - a
} else {
a - b
} * 10;
print(`x should be 810: ${x}`);