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

Username:   Password: 
 RegisterRegister   
 Detecting when an array char of boolean is empty
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BetterthanNothin




PostPosted: Wed May 29, 2019 12:47 am   Post subject: Detecting when an array char of boolean is empty

This may sound super dumb but if you have an array char of boolean, how would you detect it's empty? Like no keys are pressed?
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Fri May 31, 2019 9:17 pm   Post subject: RE:Detecting when an array char of boolean is empty

You'll need a for loop that iterates over every char and checks each for a keypress. You'll need the char() command (if I remember right) to convert your for loop iterator into chars you can pass to the array. Something like this:

Function keyPressed : boolean
For c : 1..120 % experiment to find the right values here, 120 is made up
If char_array(char(c)) then return true % if this ever returns true, a key was pressed
end for
Return false % this will only run if no keys were pressed
End keyPressed

You can also use the hasch() function, which pretty much does what you want, without bothering with char arrays or Input.Keydown.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: