PreviousUpNext

5.2.7  Mythryl for Loops

Explicit looping is not used nearly as frequently in Mythryl as it is in C, partly because arrays are not nearly as important a datastructure in Mythryl as they are in C, but in Mythryl you can write

    #!/usr/bin/mythryl

    for (i = 0; i < 10; ++i) {
        printf "%d\n" i;
    };

and when you run it, it will print out

    linux$  ./my-script
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    linux$

As we will explain later, that isn’t doing at all what you think it is doing, but in the meantime you may find it useful all the same.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext