rhai/scripts/if2.rhai

13 lines
183 B
JavaScript
Raw Normal View History

2022-01-20 05:06:36 +01:00
// This script runs an if expression.
2021-06-07 14:15:06 +02:00
let a = 42;
let b = 123;
2022-01-20 05:06:36 +01:00
let x = if a <= b { // <- if-expression
2021-06-07 14:15:06 +02:00
b - a
} else {
a - b
} * 10;
print(`x should be 810: ${x}`);