Newer Version Available

This content describes an older version of this product. View Latest

Control Flow Statements

Apex provides statements that control the flow of code execution.

Statements are generally executed line by line, in the order they appear. With control flow statements, you can cause Apex code to execute based on a certain condition or you can have a block of code execute repeatedly. This section describes these control flow statements: if-else statements and loops.