diff --git a/scripts/array.rhai b/scripts/array.rhai index 1d0768bd..cc6fc642 100644 --- a/scripts/array.rhai +++ b/scripts/array.rhai @@ -1,7 +1,9 @@ let x = [1, 2, 3]; -print(x[1]); // prints 2 +print("x[1] should be 2:"); +print(x[1]); x[1] = 5; -print(x[1]); // prints 5 +print("x[1] should be 5:"); +print(x[1]); diff --git a/scripts/assignment.rhai b/scripts/assignment.rhai index 9554a7e5..82ff7d92 100644 --- a/scripts/assignment.rhai +++ b/scripts/assignment.rhai @@ -1,2 +1,4 @@ +print("x should be 78:"); + let x = 78; print(x); diff --git a/scripts/comments.rhai b/scripts/comments.rhai index 645105bb..f5d24c93 100644 --- a/scripts/comments.rhai +++ b/scripts/comments.rhai @@ -3,7 +3,8 @@ let /* I am a spy in a variable declaration! */ x = 5; /* I am a simple - multi-line comment */ + multi-line + comment */ /* look /* at /* that, /* multi-line */ comments */ can be */ nested */ diff --git a/scripts/for1.rhai b/scripts/for1.rhai index 8eafedde..8fc6c95e 100644 --- a/scripts/for1.rhai +++ b/scripts/for1.rhai @@ -1,6 +1,6 @@ // This script runs for-loops -let arr = [1,2,3,4]; +let arr = [1, 2, 3, 4]; for a in arr { for b in [10, 20] { diff --git a/scripts/function_decl1.rhai b/scripts/function_decl1.rhai index 4e97e47c..908bcdec 100644 --- a/scripts/function_decl1.rhai +++ b/scripts/function_decl1.rhai @@ -4,4 +4,6 @@ fn bob() { return 3; } -print(bob()); // should print 3 +print("bob() should be 3:"); + +print(bob()); diff --git a/scripts/function_decl2.rhai b/scripts/function_decl2.rhai index 201dcea4..0d72743e 100644 --- a/scripts/function_decl2.rhai +++ b/scripts/function_decl2.rhai @@ -7,6 +7,10 @@ fn addme(a, b) { a + b; // notice that the last value is returned even if terminated by a semicolon } -print(addme(a, 4)); // should print 46 +print("addme(a, 4) should be 46:"); + +print(addme(a, 4)); + +print("a should still be 3:"); print(a); // should print 3 - 'a' is never changed diff --git a/scripts/function_decl3.rhai b/scripts/function_decl3.rhai index 339c4b61..4901f5c9 100644 --- a/scripts/function_decl3.rhai +++ b/scripts/function_decl3.rhai @@ -4,4 +4,6 @@ fn f(a, b, c, d, e, f) { a - b * c - d * e - f } -print(f(100, 5, 2, 9, 6, 32)); // should print 4 +print("f() call should be 4:"); + +print(f(100, 5, 2, 9, 6, 32)); diff --git a/scripts/if1.rhai b/scripts/if1.rhai index 6f414a78..cbfe2938 100644 --- a/scripts/if1.rhai +++ b/scripts/if1.rhai @@ -3,12 +3,12 @@ let b = 123; let x = 999; if a > b { - print("a > b"); + print("Oops! a > b"); } else if a < b { - print("a < b"); + print("a < b, x should be 0"); let x = 0; // this 'x' shadows the global 'x' print(x); // should print 0 } else { - print("a == b"); + print("Oops! a == b"); } \ No newline at end of file diff --git a/scripts/op1.rhai b/scripts/op1.rhai index 5351f999..bedfa563 100644 --- a/scripts/op1.rhai +++ b/scripts/op1.rhai @@ -1 +1,3 @@ -print(34 + 12); // should be 46 +print("The result should be 46:"); + +print(34 + 12); diff --git a/scripts/op2.rhai b/scripts/op2.rhai index fedbd0aa..e00a1b99 100644 --- a/scripts/op2.rhai +++ b/scripts/op2.rhai @@ -1,2 +1,4 @@ +print("The result should be 182:"); + let x = 12 + 34 * 5; -print(x); // should be 182 +print(x); diff --git a/scripts/op3.rhai b/scripts/op3.rhai index 7811dbac..aa7349a8 100644 --- a/scripts/op3.rhai +++ b/scripts/op3.rhai @@ -1,2 +1,4 @@ +print("The result should be 230:"); + let x = (12 + 34) * 5; -print(x); // should be 230 +print(x);