Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

for loop problem

 
gurpeet singh
Ranch Hand
Posts: 924
1
Fedora Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please refer the kb6 book page no 349. the book says

The next example demonstrates a for loop with multiple variables in play. A
comma separates the variables, and they must be of the same type. Remember that
the variables declared in the for statement are all local to the for loop, and can't
be used outside the scope of the loop




why is this happening ?
 
John Jai
Rancher
Posts: 1776
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have the book for reference. May be the book refers to declaring more than one type in the for loop.

 
Helen Ma
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a for loop , only one type of variable can be declared, according to the KB book.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic