Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How do you write a loop that exits when any key is pressed?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
sarm2005




PostPosted: Tue Mar 11, 2008 12:50 pm   Post subject: How do you write a loop that exits when any key is pressed?

well?
Sponsor
Sponsor
Sponsor
sponsor
BigBear




PostPosted: Tue Mar 11, 2008 12:52 pm   Post subject: Re: How do you write a loop that exits when any key is pressed?

First I am wondering if this has to be a loop. Input.Pause waits for input then continues the program. If this isn't what you are looking for please provide more information. Hope this helps.
sarm2005




PostPosted: Tue Mar 11, 2008 1:18 pm   Post subject: Re: How do you write a loop that exits when any key is pressed?

Yeah. I need it to be a loop since I want something else to happen every so often if a key is not pressed.
Sean




PostPosted: Tue Mar 11, 2008 1:37 pm   Post subject: Re: How do you write a loop that exits when any key is pressed?

Well, a simple if statement and an Input.KeyDown is required.

You want it to detect if a key was pressed then perform this action:

Turing:

exit


It will exit when that certain button you assigned it to exit upon is pressed.
Mackie




PostPosted: Tue Mar 11, 2008 1:48 pm   Post subject: RE:How do you write a loop that exits when any key is pressed?

code:
loop
    % Do stuff
    exit when hasch
end loop


Easy way.
sarm2005




PostPosted: Tue Mar 11, 2008 1:58 pm   Post subject: Re: How do you write a loop that exits when any key is pressed?

Ok. That works. Thank you.
Sean




PostPosted: Tue Mar 11, 2008 2:16 pm   Post subject: Re: How do you write a loop that exits when any key is pressed?

Mackie, I wasn't trying to give it to him, was just trying to see if he could do it Razz
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: