Notes
The continue
keyword in Apex is used to skip the rest of the code inside a loop and proceed to the next iteration. When the continue
statement is encountered, it immediately moves to the next iteration of the loop, bypassing any code that follows it within the current iteration. It is commonly used to skip certain iterations based on a specific condition.
Here's a brief example using continue
in a "for" loop:
for (Integer i = 0; i < 5; i++) {
if (i == 2) {
System.debug('Skipping iteration 2');
continue;
}
System.debug('Iteration ' + i);
}
Output:
Iteration 0
Iteration 1
Skipping iteration 2
Iteration 3
Iteration 4
Video
Video does not exists.