add example scripts for comments and loop

This commit is contained in:
Lukáš Hozda 2017-10-28 17:44:05 +02:00
parent 347191505d
commit 780962fcea
2 changed files with 18 additions and 0 deletions

10
scripts/comments.rhai Normal file
View File

@ -0,0 +1,10 @@
// I am a single line comment!
let /* I am a spy in a variable declaration! */ x = 5;
/* I am a simple
multiline comment */
/* look /* at /* that, /* multiline */ comments */ can be */ nested */
/* sorrounded by */ x // comments

8
scripts/loop.rhai Normal file
View File

@ -0,0 +1,8 @@
let x = 10;
// simulate do..while using loop
loop {
print(x);
x = x - 1;
if x <= 0 { break; }
}