Results 1 to 5 of 5

Thread: [RESOLVED] Doesn't enter for loop

  1. #1
    Hyperactive Member Cyb3rH4Xter's Avatar
    Join Date
    May 09
    Location
    Sweden
    Posts
    449

    Resolved [RESOLVED] Doesn't enter for loop

    Here is the loop code:

    Code:
                    
    for(int i = 1; i == args.Length;i++)
                    {
                    }
    When I breakpoint it, it goes to the i = 1 then the args.Length and then it just goes to the code under the loop?? Why?

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 05
    Location
    Sweden
    Posts
    8,013

    Re: Doesn't enter for loop

    The loop will execute as long as the second expression (i == args.Length) evaluates to true.
    Is this the case? Does args.Length return 1? Even if that was the case, it would only execute the loop once.
    ---My Flickr photo (mostly screenshots these days!) stream. Have a look!

    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    TCP client/server connection | Retrieving the EventHandler for any Event by code.
    Check out the work in progress: Vortex - C++ 3D Game engine for windows and linux - (Development blog - Leave a comment!)

  3. #3
    Hyperactive Member Cyb3rH4Xter's Avatar
    Join Date
    May 09
    Location
    Sweden
    Posts
    449

    Re: Doesn't enter for loop

    args.Lenght return 8 when I use breakpoints....

  4. #4
    Raging swede Atheist's Avatar
    Join Date
    Aug 05
    Location
    Sweden
    Posts
    8,013

    Re: Doesn't enter for loop

    I assume you intend to iterate over the contents of args?
    Code:
    for(int i = 0; i < args.Length; i++)
    {
    }
    ---My Flickr photo (mostly screenshots these days!) stream. Have a look!

    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    TCP client/server connection | Retrieving the EventHandler for any Event by code.
    Check out the work in progress: Vortex - C++ 3D Game engine for windows and linux - (Development blog - Leave a comment!)

  5. #5
    Hyperactive Member Cyb3rH4Xter's Avatar
    Join Date
    May 09
    Location
    Sweden
    Posts
    449

    Re: Doesn't enter for loop

    Now it works
    I had used == instead of <.

    Oh and I want to start from 1.

    Thx for helping :P

Posting Permissions

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