Industrial Training




Apex - Decision making


Decision-making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.

In this chapter, we will be studying the basic and advanced structure of decision-making and conditional statements in Apex. Decision-making is necessary to control the flow of execution when certain condition is met or not. Following is the general form of a typical decision-making structure found in most of the programming languages Decision Making




Sr.No. Statement & Description
1 if statement An if statement consists of a Boolean expression followed by one or more statements.
2 if...else statement An if statement can be followed by an optional else statement, which executes when the Boolean expression is false.
3 if...elseif...else statement An if statement can be followed by an optional else if...else statement, which is very useful to test various conditions using single if...else if statement.
4 nested if statement You can use one if or else if statement inside another if or else if statement(s).





Hi I am Pluto.