X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=demos%2Frepeat.c;h=db3726a31cbeb55d1986a43e50b79b5ca6057fa5;hb=eb0d8f8c793b40623f60e51c055f8a7cb7cae668;hp=b6229e928c4ad2981c4b53fa3f68604311825b39;hpb=a3c2aecbff1dd82a26f3a69a3e1fdc04349b8d7a;p=svn%2FCll1h%2F.git diff --git a/demos/repeat.c b/demos/repeat.c index b6229e9..db3726a 100644 --- a/demos/repeat.c +++ b/demos/repeat.c @@ -9,12 +9,28 @@ program 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: "); + echo("Outer 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("Last loop is not nested and it is supposed to be repeated again just twice."); + } }