Add control flow
authorLuke Lau <luke_lau@icloud.com>
Fri, 8 Nov 2019 15:07:55 +0000 (15:07 +0000)
committerLuke Lau <luke_lau@icloud.com>
Fri, 8 Nov 2019 15:07:55 +0000 (15:07 +0000)
commit705b0b8458673edb7273e6e19914390a55e51d23
tree4fdbf4e22df7a6d90adfa3e37101e7a500d313d3
parent7b8ef6725099f09b81f8c39ca6f00dec14213bed
parent1efb9b89acd3aeda0814540a5d96c49bb8b172c4
Add control flow

So far our language can parse and evaluate floating point expressions.
However each expression and it's subexpressions always gets evaluated. To
do more complex computations, we want to be able to control what gets
evaluated and what doesn't.

This is known as control flow, and the two most famous imperative
constructs are probably the if statement and for loop. We will add them
to our language in this chapter, and finally put our boolean expressions
(42 < i) to good use.