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

Username:   Password: 
 RegisterRegister   
 hasch help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lucky8




PostPosted: Sun Mar 01, 2009 3:36 pm   Post subject: hasch help

i need some help with hasch command, i got 3 infinite loop in my program and i used hasch in the first two loop to exit to the next loop but when it enters the next loop it only execute once then it goes to the third loop.

here's what i mean

loop
put "hi"
exit when hasch
end loop

loop
put "bye"
exit when hasch
end loop

it'll loop hi untill i press any key but when it goes to second loop it only put 1 bye then end
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Sun Mar 01, 2009 3:54 pm   Post subject: Re: hasch help

The amount of time it takes to exit the loop and draw bye to the screen takes milliseconds. So by the time your checking for a key press the second time, more often then not, you'll still be pressing the key. Either place a delay in between or find a way to register when the key is up and wait until till it is before moving to the bye loop.
BigBear




PostPosted: Sun Mar 01, 2009 3:58 pm   Post subject: RE:hasch help

Actually even with a delay(10000) it only puts it once.
lucky8




PostPosted: Sun Mar 01, 2009 4:07 pm   Post subject: Re: hasch help

problem solved Very Happy

put in a getch then it work =]
The_Bean




PostPosted: Sun Mar 01, 2009 6:46 pm   Post subject: Re: hasch help

The proper way would be with Input.Flush().
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  [ 5 Posts ]
Jump to:   


Style:  
Search: