more tests of repeat() { } macro
[svn/Cll1h/.git] / demos / repeat.c
index 70a5abec589542579a09ed499b210ff15ea3e6a8..53ddf6abcf079d500242698a91e8647da9199b22 100644 (file)
@@ -2,9 +2,31 @@
 
 program
 {
- repeat(2)
+ int i=2;
+ repeat(1)
  {
-  print("Tohle cele delam 2x:");
-  repeat(3) print("Tohle delam 3x...");
+  print("This is demonstration, that nesting of C<<1 repeat(N) { ... } flow-control macro is completely safe:");
+  repeat(i++)
+  {
+   echo("Outer loop is supposed to be done twice: ");
+   repeat(i)
+   {
+    printf("[doing this %d times] ",i);
+   } 
+   repeat(0)
+   {
+    printf("[doing this 0 times] ",i);
+   }
+   repeat(-1)
+   {
+    printf("[doing this -1 times] ",i);
+   }
+   repeat(1)
+   {
+    printf("[doing this 1 times] ",i);
+   }
+   print("... finished.");
+  }
  }
 }
This page took 0.125082 seconds and 4 git commands to generate.