Skip to content

Flow

We have seen how our programs execute sequentially in the order they appear in the source file, top-to-bottom, beginning-to-end.

Calling a method makes the code enter that method, then return to the place after the method call. This is still sequential.

We may want to change this flow of execution so that some statements only execute when certain conditions are true.

We do this with conditionals.

conditional

A decision making statement in a program that controls whether a section of code executes.

The most basic conditional is the if statement.


Prev -- Up -- Next