May 2019
Intermediate to advanced
546 pages
12h 41m
English
A do-while loop executes a block of code for an indefinite number of times and stops when a Boolean condition remains true. The syntax of a do-while loop is as follows:
do { // Code_block to execute} while (Boolean_Condition);
In the following example, we display the numbers from 1 to 10 through a do-while loop:
Integer iCount = 1;do { System.debug(iCount); iCount++;} while (iCount < 11);
Read now
Unlock full access