This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes Loops Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Loops" Watch "Loops" New topic
Author

Loops

Nath Maniedeo
Greenhorn

Joined: Feb 15, 2008
Posts: 29
hi - I'm new. our teacher wrote: "While this kind of for loop does work, it is not as readable as a more traditional loop.
If I use a for loop, I like to see all three sections used."

so, what's a more traditional loop - the while loop? (I thought this was not ideal)

what are the 3 sections of the for loop?
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1357
    
  17
Hi there,

The traditional for loop takes 3 sections:

initializor
loop test
a counting expression (often an incrementor)

this usually looks like this:
Nath Maniedeo
Greenhorn

Joined: Feb 15, 2008
Posts: 29
thank you!
 
 
subject: Loops
 
Similar Threads
print n numbers
Iteration on Enum
for and while loops
loops
for/in - developer's notebook