Conditions 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.
In a simple definition, flow control 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 $result1 = 1 < 5 $result1 = 7 >= 7 $result1 = 6 <= 7 $result1 = $x == $y