rhai/scripts/function_decl3.rhai

14 lines
274 B
JavaScript
Raw Normal View History

2022-01-20 05:06:36 +01:00
// This script defines a function with many parameters.
//
2020-03-16 07:50:12 +01:00
2021-04-17 12:40:16 +02:00
const KEY = 38;
fn f(a, b, c, d, e, f) {
2022-01-20 05:06:36 +01:00
let x = global::KEY; // <- access global module
a - b * c - d * e - f + x
}
2021-06-07 14:15:06 +02:00
let result = f(100, 5, 2, 9, 6, 32);
2020-05-02 10:23:36 +02:00
2021-06-07 14:15:06 +02:00
print(`result should be 42: ${result}`);