CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2009
    Posts
    88

    question about the for loop

    When debugging I noticed what happens around this construct:
    for(something) if(something) do something;
    do something else;

    The second is interpreted as part of the loop, which contradicts what I thought previously: the loop is terminated with the first semicolon unless there are braces present.
    I fixed it thus:
    for(something) {if(something) do something;}
    do something else;

    but am still wondering why it acts that way, and whether the if expression has something to do with it.

  2. #2
    Join Date
    May 2009
    Posts
    2,413

    Re: question about the for loop


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured