View Poll Results: Uhh...vote

Voters
20. You may not vote on this poll
  • do-while

    4 20.00%
  • while

    13 65.00%
  • I never use any of these

    1 5.00%
  • Who cares

    2 10.00%

do-while vs while

This is a discussion on do-while vs while within the C++ Programming forums, part of the General Programming Boards category; I could be wrong, but I think do-while and while were part of the original C language, and basically C++ ...

  1. #31
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    I could be wrong, but I think do-while and while were part of the original C language, and basically C++ just inherited them.

  2. #32
    Registered User
    Join Date
    Sep 2002
    Posts
    11
    I'm with some of the other guys.

    Each is useful in different contexts. If you don't need to go into the loop at least once, why bother.

    DS

  3. #33
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Because sometimes you only want to go into the loop if a certain condition is true; thus, with a while loop, you can cut out an extra if statement which might make your code uglier.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #34
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    The poll is now closed.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Page 3 of 3 FirstFirst 123
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