0
Can we use a variable assigned into while loop outside the loop?
6 Answers
+ 6
Assigned yes, declared no.
int a;
while (condition)
{a+=1;}
int b = a; //will work
while (condition)
{int a =+1;}
int b = a; //error
+ 3
Public or protected in this case not affect variable visibility scope.
+ 1
Just updated answer
0
can you please explain with help of example Dima
0
As @Dima said is correct
0
Even if you make it public?