True/false toggle?
-
I don't suppose there is some sort of built in toggle method for true and false, is there? Example of how I wanted to use it:
` reverse = false
def (key, repeat, flags, view)
if key == VK_UP
reverse.toggle
end
end #onKeyUp`The .toggle method does not exist, but it is what I was hoping to find, and hoping I just didn't know what it was called. Anything like this in the Ruby language?
Chris
-
Chris,
Personally, I just use
reverse = !reverse -
Aha! That does precisely what I was hoping for! Thanks Fredo,
Chris
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement