+ 7
Accessing an initialized variable value outside a for loop?
I want to access the value of a variable inside a for loop outside of it without using a nested loop. i will be accessing the value of the first for loop variable value to use as a condition in the second for loop.. i would declare/initialize the variable outside the the first for loop but im not sure if the value would change? plus im not certain how to write a for loop with a variable declared/initialized outside. Any help would be great thanks
2 ответов
+ 3
https://code.sololearn.com/c4FP5puYwnG9/?ref=app
or
for(i=2;i<6;i++) if you have declared variable.
+ 4
thanks @shobhit thats actually what i ment.