Move to lib style, move scripts into their own directory, start source examples

This commit is contained in:
jonathandturner
2016-03-03 10:55:28 -05:00
parent fbb5b72f24
commit fee3852979
13 changed files with 22 additions and 18 deletions

2
scripts/assignment.rhai Normal file
View File

@@ -0,0 +1,2 @@
var x = 78
print(x)

View File

@@ -0,0 +1,5 @@
fn bob() {
3
}
print(bob())

View File

@@ -0,0 +1,5 @@
fn addme(a, b) {
a+b
}
print(addme(3, 4))

View File

@@ -0,0 +1,5 @@
fn f(a, b, c, d, e, f) {
a - b * c - d * e - f
}
print(f(100, 5, 2, 9, 6, 32))

5
scripts/if1.rhai Normal file
View File

@@ -0,0 +1,5 @@
var a = true;
if (a) {
var x = 56;
print(x);
}

1
scripts/op1.rhai Normal file
View File

@@ -0,0 +1 @@
print(34 + 12)

1
scripts/op2.rhai Normal file
View File

@@ -0,0 +1 @@
print(12 + 34 * 5)

1
scripts/op3.rhai Normal file
View File

@@ -0,0 +1 @@
print(0 + (12 + 34) * 5)

5
scripts/speed_test.rhai Normal file
View File

@@ -0,0 +1,5 @@
var x = 1000000;
while x > 0 {
x = x - 1;
}
print(x);

4
scripts/string.rhai Normal file
View File

@@ -0,0 +1,4 @@
print("hello");
print("this\nis \\ nice");
print("40 hex is \x40");
print("fun with unicode: \u2764 and \U0001F603");

6
scripts/while.rhai Normal file
View File

@@ -0,0 +1,6 @@
var x = 10;
while x > 0 {
print(x);
x = x - 1;
}