Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps
by Derek Walter, Mark Sherman
Local Variables
The last type of variable is the local. It is a variable, so we know that it is a storage location with a name where we can put values in and read them out. A local variable needs to be explicitly initialized, like a global, and uses orange getters and setters, also like a global. What makes this one different is that the scope of the variable is limited. You can actually control exactly what the scope is, and that’s both cool and useful. Take a look at a local variable block in Figure 4.16. Note the notches on the top and bottom. Those mean that it clicks into a stack of action blocks: setters, procedure calls, and so on. It also has the same notch inside it, where you can put more action blocks. In addition, you can see an ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access