Pārlūkot izejas kodu

moved test files to sub directory so they aren't executed any more

kindlich 6 gadus atpakaļ
vecāks
revīzija
1e0ec99cb5
Šim parakstam datu bāzē netika atrasta zināma atslēga

ScriptingExample/scripts/classes.zs → ScriptingExample/scripts/ttt/classes.zs Parādīt failu


ScriptingExample/scripts/conditionals.zs → ScriptingExample/scripts/ttt/conditionals.zs Parādīt failu


ScriptingExample/scripts/functions.zs → ScriptingExample/scripts/ttt/functions.zs Parādīt failu


+ 22
- 0
ScriptingExample/scripts/ttt/functions_lambdas.zs Parādīt failu

@@ -0,0 +1,22 @@
1
+val outOfScope = 10;
2
+val fun1 = (a as int, b as int) as int => a + b * outOfScope;
3
+val fun2 = (a as int, c as int) as int => 13;
4
+
5
+
6
+
7
+function apply(fn as function(value as int) as int, scale as int) as int {
8
+    return fn(scale);
9
+}
10
+
11
+
12
+println(fun1(30, 20));
13
+println(fun2(30, 20));
14
+
15
+
16
+
17
+
18
+function scale(value as int, scale as int) as int {
19
+    return apply(v => v * scale, value);
20
+}
21
+
22
+println("Value: " + scale(10, 5));

ScriptingExample/scripts/helloworld.zs → ScriptingExample/scripts/ttt/helloworld.zs Parādīt failu


ScriptingExample/scripts/match.zs → ScriptingExample/scripts/ttt/match.zs Parādīt failu

@@ -23,4 +23,29 @@ println(tt1);
23 23
 //println(match test {
24 24
 //	case 1 : "tt",
25 25
 //	default : "kk"
26
-//});
26
+//});
27
+
28
+
29
+
30
+function myFunc (par1 as int) as void {
31
+
32
+    val v0 = par1 - 1;
33
+	println(match par1 {
34
+		10 => v0,
35
+		default => match(v0) {
36
+			10 => 99,
37
+			default => v0
38
+		}
39
+	});
40
+}
41
+
42
+
43
+myFunc(10);
44
+myFunc(11);
45
+myFunc(12);
46
+
47
+
48
+val t = (a as int) as int => a;
49
+
50
+
51
+println(t(10));

ScriptingExample/scripts/moreHellos.zs → ScriptingExample/scripts/ttt/moreHellos.zs Parādīt failu


ScriptingExample/scripts/statements.zs → ScriptingExample/scripts/ttt/statements.zs Parādīt failu


ScriptingExample/scripts/switch.zs → ScriptingExample/scripts/ttt/switch.zs Parādīt failu


Notiek ielāde…
Atcelt
Saglabāt