X-Git-Url: https://git.harvie.cz/?a=blobdiff_plain;f=demos%2Frepeat.c;h=491b74ddde05917cc6ed7b776aa41ba72f094eb7;hb=49df11dfb79a408ff31ebadd42c16cd5d71d6a7f;hp=70a5abec589542579a09ed499b210ff15ea3e6a8;hpb=420bb7716ee099d369582836ef4fc8ab25d81fde;p=svn%2FCll1h%2F.git diff --git a/demos/repeat.c b/demos/repeat.c index 70a5abe..491b74d 100644 --- a/demos/repeat.c +++ b/demos/repeat.c @@ -2,9 +2,35 @@ 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("This loop is supposed to be repeated 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."); + } + } + repeat(--i) + { + print("This loop is not nested and it is supposed to be repeated again just twice."); + } }