A do while loop is very much like an upside down while loop. Do while loops are not very popular and are used when we need a block of code to execute at least once. This means that the statement block is executed once before the conditional clause is checked by the program.
The layout of a do while loop has the following structure:
We haven't used a do while loop in chunk 16 but this would be very easy to implement if we needed it.
do{
do this statement
do that statement
}
while(condition)
do{
drawCircle();
drawSquare();
}
while(count <>
NOTE TO SELF
ReplyDeleteShould maybe add a do while loop ro demonstrate in final version.