Hello, everyone! Before we start,
I would like you to create a folder on your hard drive for this class. You may
name it whatever you wish. We will be creating other folders inside your class
folder later on so that we can keep separated the different objects we will be
working on.
Today we will start the class with a bit of information that will come in handy
later on. We will define and take a look at variables, parameters, attributes
and a refresher on constants. It is quite okay if you don't "get it"
right away. As long as you have this information, somewhere down the road when
we encounter them in objects, things will begin to click.
Variables
There are three types of variables, but we will only cover two in this class.
The first type is "Local Variable", and the second type is "Temporary
Storage".
Local Variable: This one is perhaps the easiest to get
confused on. Local Variables are called such because they are found in the behavior
where it is mentioned and affects only that behavior. If you
were to insert a new behavior to be run from the behavior where the Local Variable
exists, the new behavior would not be affected in any way by the variable.
Let's say you have Behavior A which contains Local Variable A. Then, you add
Behavior B as a private being run from Behavior A and it has no local variables.
If you want the Variable from Behavior A to affect Behavior B, then you need to
specify as much in the new behavior's Local Count Box, by adding 1 to what is
already there. Take a look at Fig. 1.0 below which shows Behavior A, and then
the header box from Behavior B.
Fig. 1.0
|