
-----------------------------------
Turing_Noob
Sun May 10, 2009 5:20 pm

Exit Statement
-----------------------------------
how do you make an exit statement so that when q or Q is press then the loop will exit?

-----------------------------------
Dan
Sun May 10, 2009 5:52 pm

Re: Exit Statement
-----------------------------------
Well the function for checking if a key is pressed is [tdoc]hasch[/tdoc].

And you can exit a loop with [tdoc]exit[/tdoc].

-----------------------------------
Turing_Noob
Sun May 10, 2009 5:54 pm

RE:Exit Statement
-----------------------------------
i've already tried

exit when hasch(81)

but it says error, can you give me the could that would do that

-----------------------------------
Dan
Sun May 10, 2009 6:06 pm

RE:Exit Statement
-----------------------------------
Sorry, i thought you wanted it to exit when any char was hit.

What you will have to do is use Edit: [tdoc]Input.KeyDown[/tdoc] will also work. See the example for [tdoc]Input.KeyDown[/tdoc] in the turing documentation.

-----------------------------------
DanTheMan
Thu May 14, 2009 11:17 am

RE:Exit Statement
-----------------------------------
if hasch "q" then
exit
end if

-----------------------------------
Dusk Eagle
Thu May 14, 2009 2:00 pm

Re: Exit Statement
-----------------------------------
Dan, it's great that you're trying to help, but it helps no one when your code doesn't work. What Dan said above is probably the way to go.

-----------------------------------
BigBear
Thu May 14, 2009 2:17 pm

RE:Exit Statement
-----------------------------------
You understand if you are getting input that it is hsch but you can't say if hasch "q" 

you need to declare a string variable and get that variable then compare the vlue of that variable with "q" or "Q" You could look into getch aswell

(I pronounce it getch not get ch )

-----------------------------------
DanTheMan
Fri May 15, 2009 8:26 am

Re: RE:Exit Statement
-----------------------------------
You understand if you are getting input that it is hsch but you can't say if hasch "q" 

you need to declare a string variable and get that variable then compare the vlue of that variable with "q" or "Q" You could look into getch aswell

(I pronounce it getch not get ch )

Too right. That was my fault for leaving that out.
