aspose file tools*
The moose likes Java in General and the fly likes need help with another loop Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "need help with another loop" Watch "need help with another loop" New topic
Author

need help with another loop

nicky sajdok
Greenhorn

Joined: Jan 22, 2003
Posts: 14
Hello again
The code below prints out this
[7,4,2,1,0]
addr1, id, phone, lastname, firstname
[9,8,6,5,3]
town, addr2, postcode, county, country

my problem now is that i want to put another loop inside of it so that my code will print this
ben
[7,4,2,1,0]
addr1, id, phone, lastname, firstname
alex
[9,8,6,5,3]
town, addr2, postcode, county, country
this is my loop.

thanks
nicky
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
You may have to do a triple loop, with {Ben, alex} at the outest, and manage to print the name just once.
nicky sajdok
Greenhorn

Joined: Jan 22, 2003
Posts: 14
and how would i do this?
thanks
nicky
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
i=0; i<2; i++
{
if (j + k) == 0
{
print( array[i] )
}
j=0; j<4; j++
{
k=0; k<4; k++
{
}
}
}
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

What I think Don was saying.


Please ignore post, I have no idea what I am talking about.
nicky sajdok
Greenhorn

Joined: Jan 22, 2003
Posts: 14
I have tried your idea but i just cant seem to get it to work
any other ideas please
thanks
nicky
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

If you need to understand how loops work I would suggest you start with a simpler demo example.

Start with these. Change the values, change what is printed, add code and see what happens...
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
Sorry for the bugs. I was in a hurry this morning.
To get this:
ben
[7,4,2,1,0]
addr1, id, phone, lastname, firstname
alex
[9,8,6,5,3]
town, addr2, postcode, county, country

William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 986

Not sure exactly what you are trying to show here, but the line

inside of this 'for'

doesn't make much sense to me.
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
Here j==0 is extra. It looks like I can just print out the two statements.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help with another loop