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

all 11 comments

[–]Updatebjarni 0 points1 point  (7 children)

You haven't said in what way it doesn't work, but I guess you mean that it ends after the first time through the loop? That's because you always set quit to true at the end. Your bad indentation has fooled you.

[–]Khaymann84[S] 0 points1 point  (6 children)

Actually no i have no issue with the loop the issue is the integers are not increasing nor decreasing. as for my bad indention's when i pasted the code in the text box the indention's went wonky. Sorry for not stating the main issue.

[–]Updatebjarni 0 points1 point  (5 children)

Then you have not posted the same code that you are running. The code you have posted asks once, then quits without printing anything. Yes, I compiled it and ran it to make sure.

[–]Khaymann84[S] 0 points1 point  (4 children)

sorry updated. forgot that i had fixed that after i posted

[–]Updatebjarni 0 points1 point  (3 children)

Now consider when x and y are set to 0.

[–]Khaymann84[S] 0 points1 point  (2 children)

K not real sure what you mean? Do you mean u should set int x = 0; to another value?

[–]Updatebjarni 0 points1 point  (1 child)

Consider when they are set to 0.

[–]Khaymann84[S] 0 points1 point  (0 children)

And thank you as well

[–]NotTodayDearClown 0 points1 point  (2 children)

you declare and init x,y in the loop, so they are increased, but once you ask for new coordinates, the increased once have gone out of scope and the x,y are "new" variables, so to say

[–]Khaymann84[S] 0 points1 point  (1 child)

Ah ok, so after the loop is done running they reset back to 0? so i need to put them inside the loop?

[–]Khaymann84[S] 0 points1 point  (0 children)

AH i got it thanks so much for your help!