Add for statement and range function; New register_box_fn for functions returning Box<dyn Any> (which should not be boxed again); Register standard utility functions in library (e.g. print, string concat).

This commit is contained in:
Stephen Chung
2020-02-23 22:48:46 +08:00
parent b2747b076e
commit 157aa2be94
7 changed files with 276 additions and 29 deletions

15
scripts/for1.rhai Normal file
View File

@@ -0,0 +1,15 @@
let arr = [1,2,3,4]
for a in arr {
for b in [10,20] {
print(a)
print(b)
}
if a == 3 {
break;
}
}
//print(a)
for i in range(0,5) {
print(i)
}