diff options
| author | 2022-08-25 10:38:08 +0200 | |
|---|---|---|
| committer | 2022-08-25 10:38:08 +0200 | |
| commit | 128c854f4ecb5f158cce3d91bb266ab000f27d4b (patch) | |
| tree | 3cf34279e1d325f3f5a83a5524fe3c23462f3b98 /test | |
| parent | c511c1a189cf0df60487c286caced0b251104859 (diff) | |
add cond switch
Diffstat (limited to 'test')
| -rw-r--r-- | test/1.cff | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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]); + } } |