**True** and **false** are values. Values are the results of expressions.
** True and false
are the results of Boolean expressions.** (Boolean expressions are named after a
mathematician named Boole who formalized the mathematics of true and false.)

Now, an arithmetic expression may have a result value of -3, 0, 2.85, and so
on. For example, 5 - 8 = -3. These are numeric values. A Boolean expression
can have a result value of only true or false. A Boolean expression equals
**true** or it equals **false**. These are Boolean
values.

Boolean expressions come in many types. For our tutorial purposes here, we will
say that Boolean expressions are used when you want to compare two numeric values. They answer
questions like: 'Is the first value greater than the second value?' or: 'Are
these two values equal?' When a Boolean expression answers questions such as
these, it is said to evaluate to **true** or **false**. One might say that the Boolean
expression returns **true** or **false**, or that the Boolean expression becomes
**true** or
**false**.

In order to write Boolean expressions you first need to know the programing symbols for math statements like: 'is equal to' or: 'is greater than'. These symbols are:

== | That is two equal signs, one after the
other. It means: 'is equal to'. So: (2 == 2) reads: 'two is equal to two', and this evaluates to true.So: (2 == 3) reads: 'two is equal to three', and this evaluates to false. |

!= | That is an exclamation point followed by an
equal sign. It means: 'not equal to'. So: (2 != 2) reads: 'two does not equal two', and this returns false.So: (2 != 3) reads: 'two does not equal three' and this returns true. |

> | This is the greater than sign, and it means:
'is greater than'. So: (3 > 2) reads: 'three is greater than two', and this evaluates to true.So: (2 > 3) reads: 'two is greater than three', and this evaluates to false. |

< | This is the less than sign, and it means:
'is less than'. So: (2 < 3) reads: 'two is less than three', and this is true.So: (3 < 2) reads: 'three is less than two', and this is false. |

>= | This is a greater than sign followed by an
equal sign. It means: 'is greater than or equal to'. So: (2 >= 2) reads: 'two is greater than or equal to two', and this returns true.So: (2 >= 3) reads: 'two is greater than or equal to three', and this returns false. |

<= | This is a less than sign followed by an
equal sign. It means: 'is less than or equal to'. So: (3 <= 2) reads: 'three is less than or equal to two', and this evaluates to false.So: (2 <= 3) reads: 'two is less than or equal to three', and this evaluates to true. |

The parentheses around the Boolean expressions, such as (2 == 2), in the table above are optional. They do make the expressions easy to read, though, and we will usually adopt this style at EZ Math Movie.

People's names have values like 'Tom' and 'Sue'. Numbers have values like 1, 2,
and 3. Boolean expressions can have only two values: **true** or
**false**. So, if
someone made this programing statement:

a = (2 == 2);

Then the variable **a** would hold the value** true**
since the boolean statement (2 == 2) is true. And if we followed this up with:

print(a);

Then we would actually see the word 'true' on the printer.

Boolean expressions may look a bit unusual when first encountered, especially when a variable is set equal to one. A variable in EZ Math Movie can hold a numeric value or a Boolean value. (There are other types of values they can hold, too, but that does not concern us currently.)

Note that when you print a variable that holds a Boolean value, then the words 'true' or 'false' will appear on the printer.

For learning purposes, the example program prints the results of Boolean expressions without showing how they are to be used practically. Boolean expressions, as we will see, are most often used to control decisions and loops.

Bounds:

Printer

Edit:
Runtime
View:
Starter
Suggestion

To runtime:

Storage:

Editor width: Normal Wide

To runtime:

Storage:

Editor width: Normal Wide

Custom Search

Name:

Domain:

Name

0

Name:

Name

0