Quellcode durchsuchen

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

kindlich vor 6 Jahren
Ursprung
Commit
1e0ec99cb5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden

ScriptingExample/scripts/classes.zs → ScriptingExample/scripts/ttt/classes.zs Datei anzeigen


ScriptingExample/scripts/conditionals.zs → ScriptingExample/scripts/ttt/conditionals.zs Datei anzeigen


ScriptingExample/scripts/functions.zs → ScriptingExample/scripts/ttt/functions.zs Datei anzeigen


+ 22
- 0
ScriptingExample/scripts/ttt/functions_lambdas.zs Datei anzeigen

@@ -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 Datei anzeigen


ScriptingExample/scripts/match.zs → ScriptingExample/scripts/ttt/match.zs Datei anzeigen

@@ -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 Datei anzeigen


ScriptingExample/scripts/statements.zs → ScriptingExample/scripts/ttt/statements.zs Datei anzeigen


ScriptingExample/scripts/switch.zs → ScriptingExample/scripts/ttt/switch.zs Datei anzeigen


Laden…
Abbrechen
Speichern