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?

27th Jul 2018, 7:13 AM
erns
2 odpowiedzi
0
Declare 'a' before using it in the for loop. int a; for(a = 0; value; a++) { ... } System.out.println(a)
27th Jul 2018, 7:57 AM
apex137
apex137 - avatar
0
OK, that works; thx
27th Jul 2018, 8:29 AM
erns