
============
Control Flow
============

Other than JavaScript's ``if (x) y`` and ``while (x) y`` or ``do x while (y)``,
Nonstraightforward has its own control flow.

#####################
Conditional statement
#####################

Conditional statements are done with ``stipulate that the provision x qualifies
y`` where ``x`` is a condition and ``y``  is a statement or block.

.. code-block:: text

    stipulate that the provision 1 === "1" qualifies {
        ~/dev/stdout/write/ln("your runtime is broken");
    }

##########
Exceptions
##########

Exceptions can be used normally with the ``throw`` keyword, or the far superior
``retaliate`` keyword.

#####
Loops
#####

While loops
^^^^^^^^^^^

While-loops are done with ``so long as the condition x is still upholding, then
do y``.

.. code-block:: text

    mutable readwrite variable i = 0;
    so long as the condition i < 10 is still upholding, then do {
        ~/dev/stdout/write/ln(['i = ', i].join(""));
        i += 1;
    }

Do-while loops
^^^^^^^^^^^^^^

There is no Nonstraightforward do-while syntax yet, so ``do``/``while`` is the
only option right now.

For loops
^^^^^^^^^

Not supported yet. Trust me, it's painful not having them.

################
Pattern matching
################

Nonstraightforward has JavaScript's ``switch`` statement. The ``match``
statement is also planned to be added.
