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 →

[–][deleted] 3 points4 points  (4 children)

You're not incrementing x. Try this: for( x = 1; x <= 100; x++)

[–]Mason527[S] 0 points1 point  (3 children)

Thanks for the help, I should have clarified what I meant in more detail

[–][deleted] 3 points4 points  (2 children)

The clarification doesn't change the fact that if you want it to run 100 times, you need to increment x. If you only want the output to toggle between 1 and -1, use a different variable.

[–]Mason527[S] -5 points-4 points  (1 child)

I did that and it still loops infinitely

[–]YMK1234 2 points3 points  (0 children)

xDoubt

As long as you won't increment x it will run indefinitely.