0
How can I retrieve a for-loop variable outside the loop?
Hello together, I've got a simple for loop like this: for(int a=0;value;a++){ } And now I want to select the int a outside the loop like that: System.out.println(a); What do I have to change in my code that it works?
2 Answers
0
Declare 'a' before using it in the for loop.
int a;
for(a = 0; value; a++) {
...
}
System.out.println(a)
0
OK, that works; thx