rhai 0.16.0

Embedded scripting for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This script runs for-loops

let arr = [1, 2, 3, 4];

for a in arr {
    for b in [10, 20] {
        print(a + "," + b);
    }

    if a == 3 { break; }
}
//print(a);                 // <- if you uncomment this line, the script will fail to run
                            //    because 'a' is not defined here

for i in range(0, 5) {      // runs through a range from 0 to 4
    print(i);
}