0

For loops got me stuck with no points to help

25th Jul 2017, 9:54 PM
Shad Schorling
Shad Schorling - avatar
3 Antworten
+ 7
for (initialization; condition; increment) { //do something } E.g. for (int i = 0; i < 10; i++) { } is similar to int i = 0; while (i < 10) { i++; }
26th Jul 2017, 5:36 AM
Hatsy Rei
Hatsy Rei - avatar
0
For loops are wonderful! If you know how many times you want to iterate (doing the thing you wanna do many times over) they help get you there. Let's say you wanna do something 100 times. in pseudocode for x=0 (provide initial value) x<100 (set your boundary) x++ (x is increasing by 1 for every iteration) { //do a thing } for x=0; x<100; x++; { //do a thing }
25th Jul 2017, 10:20 PM
Eli Dwor
Eli Dwor - avatar
0
thank you
29th Jul 2017, 11:09 PM
Shad Schorling
Shad Schorling - avatar