| Author |
for loop
|
Vlada Den
Ranch Hand
Joined: Dec 19, 2004
Posts: 32
|
|
Hi! Is it possible to declare more than one variable in the initialization part of for loop? If yes, could you post some code examples? Thanks! Vlada
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Yup.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Chris Wox
Ranch Hand
Joined: May 25, 2006
Posts: 34
|
|
for (byte i = 1, j = 1; i < 10 , i++, j++); { System.out.println(i + ":" + j) ; } you can also increment both variables [ May 26, 2006: Message edited by: Chris Wox ]
|
 |
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
|
posted

0
|
|
for loop
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
|
Note that variables declared in a for loop must all be of the same type (i.e., as a single line of code).
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
 |
|
|
subject: for loop
|
|
|