summary refs log tree commit diff stats
path: root/tests/tcasestm.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcasestm.nim')
-rwxr-xr-xtests/tcasestm.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/tcasestm.nim b/tests/tcasestm.nim
new file mode 100755
index 000000000..ef3f2dfc9
--- /dev/null
+++ b/tests/tcasestm.nim
@@ -0,0 +1,20 @@
+# Test the case statment
+
+type
+  tenum = enum eA, eB, eC
+
+var
+  x: string
+  y: Tenum = eA
+
+case y
+of eA: write(stdout, "a\n")
+of eB, eC: write(stdout, "b oder c\n")
+
+x = readLine(stdin)
+case x
+of "Andreas", "Rumpf": write(stdout, "Hallo Meister!\n")
+of "aa", "bb": write(stdout, "Du bist nicht mein Meister\n")
+of "cc", "hash", "when": nil
+of "will", "it", "finally", "be", "generated": nil
+else: write(stdout, "das sollte nicht passieren!\N")