Monday 8 December 2008

do While - First Draft



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:

do{
do this statement
do that statement
}
while(condition)

do{
drawCircle();
drawSquare();
}
while(count <>
We haven't used a do while loop in chunk 16 but this would be very easy to implement if we needed it.

1 comment:

  1. NOTE TO SELF
    Should maybe add a do while loop ro demonstrate in final version.

    ReplyDelete