rhai/scripts/if2.rhai

13 lines
184 B
JavaScript
Raw Permalink Normal View History

2022-07-24 17:03:35 +02:00
//! This script runs an if expression.
2022-01-20 05:06:36 +01:00
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}`);