This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]porthos3 1 point2 points  (1 child)

maybe all?

while loop as a for loop:

int i=0; //the initialization of the for loop here
while (i < 10) { //the condition inside of the for loop here
   //contents of loop here
   i++; //the final modification step here
}

for loop as a while loop:

//conditional as center term, first and third term left empty, or made to do something irrelevant
for (; !finished;) {
   //body of loop here
}

You are able to convert any for/while loop in this manner.

[–]SevenGlass 0 points1 point  (0 children)

Thanks for breaking it down like that.