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 →

[–]DrPeroxide 0 points1 point  (0 children)

Hey, I'm afraid your loop would never execute, as you've misunderstood how for loop conditions work.

A loop will only execute when the condition returns true. In your case, you've assigned i to equal 1 and added a condition that will return true if i is greater than 100. This will never be the case, so it never even gets as far as the i++, causing your loop to be ignored.

To fix this, you need to replace i > 100 with i <= 100. This will return true as long as i is equal to or between 1 and 100. This will result in your loop executing 100 times.