Part 4.1Conditions in YASS
Flow control is one of the most important parts of programming. It allows programs to perform operations that are not defined to give the same output each time and to vary based on input. This type of flow control is called a decision.
Simply put, a decision is like a road with many roads branching off of it - go left and you end up in town A or go right and you end up in town B. In this situation, a decision is made. The decision is based on some condition; you are going there because there is something you need there and it has it. This is where conditions come in.
What is a condition?
A condition is a set of requirements that must be satisfied. A condition evaluates to a Boolean value, true or false. Conditions can be used in control flow statements such as if statements and loops so they are a major part of any computer program. Alternatively, conditions can be evaluated and stored in a variable.
The next example shows conditions in YASS syntax.
$result1 = true or false $result2 = true and false $result3 = true and true $result4 = false or false
Conditions can be used not just to check for equality, but also to access mathematical comparisons:
$result1 = 1 > 5 $result2 = 1 < 5 $result3 = 7 >= 7 $result4 = 6 <= 7 $result5 = $x == $y