Previous Topic: Conditional StatementsNext Topic: The else if Statement


The if Statement

The if conditional selection statement uses the following syntax:

if (Boolean_expression)

statement

The Boolean_expression is any combination of functions, variables, values, and operators that returns a single True or False value. For example:

if (i <= 18) {
	y = 18 * I
	z = y * 56
}

The second form of the if conditional selection statement allows for two outcomes of the Boolean expression. It uses the following syntax:

if (Boolean_expression)
	statement1
else
	statement2
For example:
if (i <= 18)
	Process.Date = System.Date
else
	Process.Date = "2006/01/23"