Template:Computer Programming/Control/1

From Wikibooks, open books for an open world
Jump to: navigation, search

Conditionals[edit]

Conditional clauses are blocks of code that will only execute if a particular expression (the condition) is true.

if-else[edit]

The if-else statement is the simplest of the conditional statements. They are also called branches, as when the program arrives at an if statement during its execution, control will "branch" off into one of two or more "directions". An if-else statement is generally in the following form: