What is the fundamental difference between the do loop and the while loop?

This is a discussion on What is the fundamental difference between the do loop and the while loop? within the C Programming forums, part of the General Programming Boards category; Question: What is the fundamental difference between the do loop and the while loop? Thanks...

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    33

    Question What is the fundamental difference between the do loop and the while loop?

    Question:

    What is the fundamental difference between the do loop and the while loop?

    Thanks

  2. #2
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    A do loop tests the condition after executing it the body initially. A while loop tests the condition before entering.

  3. #3
    ex-DECcie
    Join Date
    Dec 2005
    Posts
    125
    Quote Originally Posted by Tonto
    A do loop tests the condition after executing it the body initially. A while loop tests the condition before entering.
    So with a do-while loop, you're always guaranteed to execute the body of the loop at least once.
    Mr. Blonde: You ever listen to K-Billy's "Super Sounds of the Seventies" weekend? It's my personal favorite.

  4. #4
    Registered User
    Join Date
    Feb 2006
    Posts
    33
    Thank you That clears it up for me

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21