+ 1

Hello. Explain me the 'for' loop .

I don't clearly understand when I want to find the final value of my variable using that loop.

24th Nov 2016, 4:05 AM
Saklaen
5 Antworten
+ 1
for(initial_value;condition_test;what_to_do_with_that_value_every_loop){loop to execute }
24th Nov 2016, 5:10 AM
Wagner Silvestre Wuchryn Martins
Wagner Silvestre Wuchryn Martins - avatar
+ 1
thanks, wagner
24th Nov 2016, 6:26 AM
Saklaen
+ 1
for(x=0;x<4;x++){ document.write(x);} is basically equal to, var x=0; while(x<4){ x++;}
28th Nov 2016, 1:02 PM
Foxtrot Pipe
Foxtrot Pipe - avatar
0
example, after running: for(X=0;X<5;X++){ print(X); } the last value that was given to this for loop as X was 5, but 5<5 evaluate as false, so the code did not executed, the last printed value would be 4
24th Nov 2016, 5:17 AM
Wagner Silvestre Wuchryn Martins
Wagner Silvestre Wuchryn Martins - avatar
0
for(initialize ; Condition; increment) { // your code } for ( int i=0; i<10; i++) { statement(s); }
24th Nov 2016, 6:39 AM
Akwin Lopez
Akwin Lopez - avatar