aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-25 10:38:08 +0200
committerlemon <lsof@mailbox.org>2022-08-25 10:38:08 +0200
commit128c854f4ecb5f158cce3d91bb266ab000f27d4b (patch)
tree3cf34279e1d325f3f5a83a5524fe3c23462f3b98 /test
parentc511c1a189cf0df60487c286caced0b251104859 (diff)
add cond switch
Diffstat (limited to 'test')
-rw-r--r--test/1.cff13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/1.cff b/test/1.cff
index cdda6b9..3854aa8 100644
--- a/test/1.cff
+++ b/test/1.cff
@@ -1,6 +1,6 @@
import "libc.hff";
-extern fn main(argc int) int {
+extern fn main(argc int, argv **u8) int {
switch argc - 1 {
case 0, 1;
printf("zero or one\n");
@@ -14,4 +14,15 @@ extern fn main(argc int) int {
case else
printf("its %d\n", argc);
}
+
+ switch {
+ case argv[1] != #null and strcmp(argv[1], "hello") == 0;
+ printf("world\n");
+
+ case argv[1] != #null and strcmp(argv[1], "42") == 0;
+ printf("forty two\n");
+
+ case else
+ printf("- %s\n", argv[1]);
+ }
}