Just as people need to remember things, so do apps. This chapter examines how you can program an app to remember information.
When someone tells you the phone number of a pizza place for a one-time immediate call, your brain stores it in a memory slot. If someone calls out some numbers for you to add, you also store the immediate results in a memory slot. In such cases, you are not fully conscious of how your brain stores information or recalls it.
An app has a memory as well, but its inner workings are far less mysterious than those of your brain. In this chapter, you’ll learn how to set up an app’s memory, how to store information in it, and how to retrieve that information at a later time.
An app’s memory consists of a set of named memory slots. Some of these memory slots are created when you drag a component into your app; these slots are called properties. You can also define named memory slots that are not associated with a particular component; these are called variables. Whereas properties are typically associated with what is visible in an app, variables can be thought of as the app’s hidden “scratch” memory.
Components—at least the visible ones like
Canvas—are part of the user interface. But to the app, each component is completely defined by a set of properties. The values stored in the ...