Tuesday, February 12, 2019

for loop


How would you explain for loops to a non coder? What do they do, and how would you write one to print out the numbers 1-10? 
Loops are when the program ends it goes back to the beginning and start again.
for(int i =0; i<10;i++)
cout<<i<<endl;
What's the difference between a single for loop and a nested for loop? What do nested for loops look like in code? What sorts of things are they used for in game programming?
A single for loop is one for loop and a nested for loop is 2 for loops. A nested for loop is one for loop on top of another. They are used to make boxes. 
What do you think the most common bugs are when coders work with for loops? Are there any mistakes you regularly make with for loops, or any parts about them that make you confused still?
I think the common bug is the way they have the for loop set up. 

No comments:

Post a Comment