The for loop is a loop for when you know the number of repeats in advance. The for loop is made up of 3 different parts, the starting index or what number you want to start at (int i =0;). The starting point is used to decide where you number will count up or down. The next part of the code is the ending point from the start to the end from (i =0) to (i<10) which means the number will stop at 10. the final part is the counter depending on whether it goes up or down (i++) in this case it means i which is 0 plus 1 up to 10.
No comments:
Post a Comment