EZ Math Movie, Tutorials, Decisions, If Statement

Decide with a Boolean.

Basically, decisions in EZ Math Movie work this way:

All this happens in an if statement,

If it is true, then....

Here is a diagram that shows the steps outlined in the previous section. This is the basic flow of an if statement:

If statement flowchart. If the Boolean statement is true do something, or else do nothing.


Let's look at a few simple descriptions that model this process. A sample Boolean statement is shown for each.

If statement syntax

So how does one do this in EZ Math Movie? The keyword if is used. Below is code that checks if x is equal to 2. If it is, it prints the text 'It is true.' Note the parentheses around the Boolean statement and the curly brackets. They are all absolutely necessary.

If syntax

The if statement details

The if keyword is part of a few lines of code that are named an 'if statement'. If statements work this way:

Running the example program

The example program sets the variables a and b to some initial values. It then checks if the value of a is less than the value of b. The program prints a message if this is true.

The example program

Angle measurement: Degrees Radians

Go on input

Sorry, apparently this browser does not support HTML 5 canvas tag graphics.

Edit: Runtime          View: Starter Suggestion

To runtime:


Editor width: Normal Wide








Next tutorial: The if with else statement


Here is a link to a related article at EZ Programing Demos:


All contents of EZ Math Movie are copyrighted: Copyright 2011, Edward A. Zobel. All rights reserved.

Other sites you may find interesting

Zona Land Education Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Here is the link: zonalandeducation.com

EZ Programing Demos Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Here is the link: ezprogramingdemos.com

Custom Search