- 2
Get the value out of a loop ?
If I have a loop: for(i=0; i!=5 ; i++) and the value 5 is reached how can I access the x value after the loop? To use it later on?
5 ответов
+ 2
Declare the variable before the for loop:
int variable = 0;
for ( int i = 0; i < 5; i++ ) {
variable += i;
}
System.out.println( variable );
0
But wouldn't it be consuming changing this variable each time if I had a loop that would go like up to 8000?
0
I'm not too sure I understand your question then, could you give me an example of what you want to do?
0
I want to do a little brute force show program. First you enter 4 digits then the program goes up to your value and then shows you what your password is.
0
its just that you cant start a loop nowhere so least possibiltiy is to keep it zero