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 from of a typical decision making structure found in most of the programming languages:
| Statement | Description |
|---|---|
| if statement | An if statement consists of a boolean expression followed by one or more statements. |
| if...else statement | An if statement can be followed by an optional else statement, which executes when the boolean expression is false. |
| 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. |
| nested if statement | You can use one if or else if statement inside another if or else if statement(s). |
No comments:
Post a Comment