for loop and scopes

This is a discussion on for loop and scopes within the C++ Programming forums, part of the General Programming Boards category; what is it usefull for...i mean it looks like the alterations of the while loop kik the for loops and ...

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    196

    for loop and scopes

    what is it usefull for...i mean it looks like the alterations of the while loop kik the for loops

    and the scope i mean whats this usefull for?if at all..
    Last edited by lilhawk2892; 07-04-2006 at 09:14 PM.

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,667
    Never use for loops. They are useless. And that scope thing... sheesh, they could have come up with something better, don't you think?
    From now on a large part of your life will be spent finding and correcting your own mistakes.
    And if you are lucky and land yourself a good job, a whole lot more time will be spent finding and correcting other people's mistakes.
    That has to be good, no?

    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Registered User
    Join Date
    Sep 2005
    Posts
    196
    quote from zeuscmd.com
    You should now understand how to use probably the most widely used loop of them all. In every useful program, you will find a number of for loops.
    lol

  4. #4
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,667
    I was hoping you got the irony. But I'm afraid you didn't.

    A while loop is usually used when one wants to process a set of expressions while a condition holds. A for loop, on the other hand (while retaining a similar principle) is better seen as a step loop.

    Both loops are similar and on most situations interchangeable. However you will soon realize that they are both needed and that on some circumstances a for loop is the only sane way to go.

    EDIT: By the way, a while loop also defines its own scope. Tough luck, eh?
    Last edited by Mario F.; 07-04-2006 at 09:58 PM.
    From now on a large part of your life will be spent finding and correcting your own mistakes.
    And if you are lucky and land yourself a good job, a whole lot more time will be spent finding and correcting other people's mistakes.
    That has to be good, no?

    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #5
    Registered User
    Join Date
    Sep 2005
    Posts
    196
    oh great your not my freind anymor!!!!
    jk

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Confused on Class scopes
    By csonx_p in forum C++ Programming
    Replies: 11
    Last Post: 07-25-2008, 04:58 AM
  2. Variable scopes; Vectors of struct's
    By relyt_123 in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2007, 10:07 PM

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