Overview
Control flow is a set of language constructs that tell a program which pieces of code to execute, and under which conditions to execute them.The simplest example of control is the the if statement. consider the following code:
let age = 12;
if(age-10 > 0){
print("greater than");
}
else{
print("less than");
}
The if statement is structured like the following:
if(expression){
code to execute if true
}
else{
code to execute if false
}
The if statement takes an expression and evaluates it. If the expression equals true, then the first block of code is executed, otherwise the second block is executed.