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

  • Home
  • SEARCH
  • 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 9240675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:13:53+00:00 2026-06-18T08:13:53+00:00

init; while (test) { statements; step; } I had a question about the location

  • 0
init; 
while (test) {
  statements;
  step;
    }

I had a question about the location of the step in the above while loop. Does it matter where the step is written? In other words does it change the any of the values in the while loop if the step is written as the first statement or somewhere in the middle or at the end? If it does can you provide a short example to illustrate that effect.

  • 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-06-18T08:13:54+00:00Added an answer on June 18, 2026 at 8:13 am

    The placement of the step could definitely influence the body of the loop. Imagine if the code below were accessing an array, the first example could miss the first element in an array.

    This outputs 0-9

    int x = 0;
    
    while(x < 10){
      System.out.println(x);
      x++; 
    }
    

    This outputs 1-10

    int x = 0;
    
    while(x < 10){
      x++; 
      System.out.println(x);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We always alloc before init in Objective C, then while writing init method, Why
In the following code snippet: NSMutableArray *tmpItemsArray =[[[NSMutableArray alloc] init] autorelease]; while (sqlite3_step(fetch_statement)==SQLITE_ROW){ int
I get: TemplateSyntaxError at /blog/post/test Caught NameError while rendering: global name 'forms' is not
While executin the test (test looks like this: http://tomee.apache.org/examples-trunk/application-composer/README.html ), I always get: java.lang.NoSuchMethodError:
I am getting same null pointer exception while running integration test in eclipse .while
Possible Duplicate: Why are there sometimes meaningless do/while and if/else statements in C/C++ macros?
The following method shows up as leaking while performing a memory-leaks test with Instruments:
I'm trying to debug an error where python import statements randomly fail, at other
We use org.springframework.batch.test.DataSourceInitializer class in order to init DB on basis of .sql scripts.
I have finally started to test my code while developing iOS applications. However, I

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.