A Tour of Morfa

While

Recall the fizzbuzz() function from the section on the if-then-else statement. Here is how you can call fizzbuzz() for every number from 0 up to 100 in a while loop:

import basics.control_flow.if_then_else: fizzbuzz;

unittest
{
    var n = 0;
    while (n <= 100)
    {
        fizzbuzz(n);
        n += 1;
    }
}

Do-while

In a do-while satement the condition is checkeed after the body is executed:

unittest
{
    var n = 0;
    do
    {
        fizzbuzz(n);
        n += 1;
    }
    while (n <= 100);
}