aboutsummaryrefslogtreecommitdiff
path: root/examples/while.sil
diff options
context:
space:
mode:
Diffstat (limited to 'examples/while.sil')
-rw-r--r--examples/while.sil7
1 files changed, 7 insertions, 0 deletions
diff --git a/examples/while.sil b/examples/while.sil
index 49186fb..fb2778b 100644
--- a/examples/while.sil
+++ b/examples/while.sil
@@ -1,3 +1,9 @@
+Void sleep(Int n) {
+ |~ pushI_a 0
+ |~ ccall sleep "I:I"
+ |~ pop_b 1
+}
+
Void print(Int n) {
|~ push_a 0
|~.d 1 0
@@ -8,6 +14,7 @@ Void print(Int n) {
Int loop(Int start, Int end) {
while (!(start == end)) {
print(start);
+ sleep(start);
start := start + 1;
}
return start;