• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

do-while

The last type of loop is the post-test, or do-while, loop. This loop will execute its contents at least once; then the conditional is tested and, if true, the loop will continue until the condition is false.

For example, if we have the same problem as previously presented, but we are guaranteed to always have at least one item in the cart, we might do the following:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint