PreviousUpNext

5.5.2  Iterate from 1 to n

Iterate from 1 to n:

    eval:  n = 3;
    eval:  for (i=1; i <= n; ++i)  printf "%d\n" i;
    1
    2
    3

Iterate from 1 to n, second way:

    eval:  n = 3;
    eval:  foreach (1..n) {. printf "%d\n" #i; };
    1
    2
    3

Comments and suggestions to: bugs@mythryl.org

PreviousUpNext