From 128c854f4ecb5f158cce3d91bb266ab000f27d4b Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 25 Aug 2022 10:38:08 +0200 Subject: add cond switch --- test/1.cff | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'test') 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]); + } } -- cgit v1.2.3