From 2f16dd2749851f0a3d5b93c55dc7f2be2aa37cd3 Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 29 Jul 2025 11:21:09 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B7=BB=E5=8A=A0=20Demo18=20=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/Demo/Demo18/Main.snow | 43 ++++++++++++++++++++++++++++++++ playground/Demo/Demo18/OS.snow | 11 ++++++++ 2 files changed, 54 insertions(+) create mode 100644 playground/Demo/Demo18/Main.snow create mode 100644 playground/Demo/Demo18/OS.snow diff --git a/playground/Demo/Demo18/Main.snow b/playground/Demo/Demo18/Main.snow new file mode 100644 index 0000000..e41610c --- /dev/null +++ b/playground/Demo/Demo18/Main.snow @@ -0,0 +1,43 @@ +module: Main + import: os + function: main + return_type: int + body: + loop: + init: + declare i:int = 1 + cond: + i <= 5 + step: + i = i + 1 + body: + if i % 2 == 0 then + continue + end if + if i > 3 then + break + end if + loop: + init: + declare j:int = 1 + cond: + j <= 5 + step: + j = j + 1 + body: + if j == 4 then + break + end if + if j % 2 == 0 then + continue + end if + print(i) + print(j) + end body + end loop + end body + end loop + return 0 + end body + end function +end module diff --git a/playground/Demo/Demo18/OS.snow b/playground/Demo/Demo18/OS.snow new file mode 100644 index 0000000..6026d43 --- /dev/null +++ b/playground/Demo/Demo18/OS.snow @@ -0,0 +1,11 @@ +module: os + import: os + function: print + parameter: + declare i1: int + return_type: void + body: + syscall("PRINT",i1) + end body + end function +end module \ No newline at end of file