Recap of Conditions

What We’ve Covered So Far

Conditions are ways that computers and robots ask questions.

Conditions can always be boiled down into a single boolean value, true or false.

== is used to compare two values to see if they are equal.

If the two values being compared are equal the condition is true, if the two values being compared are not equal the condition is false.

!= is used to compare two values to see if they are not equal.

If the two values being compared are equal the condition is false, if the two values being compared are not equal the condition is true.

< is used to compare two values to see if the value on the left is less than the value on the right.

If the value on the left is less than the value on the right the condition is true, if the value on the right is less than the value on the left the condition is false.

<= is used to compare two values to see if the value on the left is less than or equal to the value on the right.

If the value on the left is less than or equal to the value on the right the condition is true, if the value on the right is less than the value on the left the condition is false.

> is used to compare two values to see if the value on the left is more than the value on the right.

If the value on the left is more than the value on the right the condition is true, if the value on the right is more than the value on the left the condition is false.

>= is used to compare two values to see if the value on the left is more than or equal to the value on the right.

If the value on the left is more than or equal to the value on the right the condition is true, if the value on the right is more than or equal to the value on the left the condition is false.

You can use the AND operator to check multiple nested conditions inside of an overarching set of parentheses.

If both conditions are true then the over all condition using the AND is true. If just one of the conditions is false then the over all condition using the AND is false.

You can also use the OR operator to check multiple nested conditions inside of an overarching set of parentheses.

If just one of the conditions are true then the over all condition using the OR is true. If both conditions are false then the the over all condition using the OR is false.

 

Now that we’ve gone over conditions, let’s get back to if statements.

Back to If Statements