December 2013
Intermediate to advanced
448 pages
13h 44m
English
This subsection describes how to control the flow of Apex code execution. It covers conditional statements, loops, exception statements, recursion, and asynchronous execution.
Conditional statements evaluate a Boolean condition and execute one code block if true, another if false. Listing 4.18 provides an example, defining a function that prints true if an Integer argument is greater than 100, false otherwise.
Listing 4.18 Conditional Statement Usage
void testValue(Integer value) { if (value > 100) { System.debug('true'); } else { System.debug('false'); }}testValue(99);testValue(101);
In addition to this simple if, else structure, you can chain multiple conditional ...