# Pressing Keys and Setting Variables

**URL:** <https://forum.kirupa.com/t/pressing-keys-and-setting-variables/126453>\
**Category:** Uncategorized\
**Created:** [October 23, 2004, 4:20pm UTC](https://forum.kirupa.com/t/pressing-keys-and-setting-variables/126453 "2004-10-23T16:20:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phlashman](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@Phlashman](https://forum.kirupa.com/u/Phlashman)\
**Post date:** [October 23, 2004, 4:20pm UTC](https://forum.kirupa.com/t/pressing-keys-and-setting-variables/126453/1 "2004-10-23T16:20:12Z")

</div>

Hi! I am trying to make a neat and tidy code. By doing this, I want to set a variable to true when a key is pressed and false when it is released. Then, on frames I want affected, I want it to constantly check these variables and perform an action if is were to be set to true.

About that last part, would I have to constantly loop the frame so it keeps checking the variables?

Thanks.
