Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7020379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:18:39+00:00 2026-05-27T23:18:39+00:00

I was doing some programming in Cocoa Touch and Objective-C, and now I have

  • 0

I was doing some programming in Cocoa Touch and Objective-C, and now I have a really frustrating problem. I have a method in which there is a for-loop. Yet, every time I run the app in the iOS Simulator, the code in the loop isn’t run, and it doesn’t stop on any breakpoints within the loop. At first, I thought it was just in the method, but it appears now that it happens anywhere in the code. No for-loops work anywhere in any methods. Here is an example of one of my loops, and if you see anything wrong, I would appreciate the help.

for (int i = 0; i == 3; i++) {
    NSLog(@"This is a test.");
}

This might be something really dumb that I am missing, but I can’t see anything that could be causing this. If you need more code, just ask, and thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:18:39+00:00Added an answer on May 27, 2026 at 11:18 pm

    The condition on a for loop causes the loop to run as long as the condition is true.

    In the example you cited, the loop will never execute because i started off equal to zero, with the test condition i == 3. Since i == 3 is immediately false, the loop does not run even once.

    If your intention was to run the loop until i was three, then the test condition should be i < 3 making the entire for

    for (int i = 0; i < 3; i++) {
    

    Another way to think about this is that the loop will continue to run “while i < 3”.

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing some lovely socket programming in objective-C right now and part of my
Lately I have been doing some numerical method programming in C. For the bug
I'm doing some C programming on a machine for which I don't have root
I have been doing some OO Perl programming and I was wondering: which is
I' ve been doing some programming lately and faced an issue which i found
I am doing some C programming for school and I have found myself reusing
I'm doing some Objective-C programming that involves parsing an NSXmlDocument and populating an objects
I am doing some T-SQL programming and I have some Views defines on my
I'm doing some programming practice right now by trying to sort a 2D array
I'm doing some networking programming for Windows right now envolving the HTTP protocol. Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.