beautypg.com

Rules governing variable access -7-11, Rules governing variable access – Casio CLASSPAD 330 3.04 User Manual

Page 80

background image

20060301

1-7-11

Variables and Folders

Rules Governing Variable Access

Normally, you access a variable by specifying its variable name. The rules in this section
apply when you need to reference a variable that is not located in the current folder or to
access a variable that has the same name as one or more variables located in other folders.

I Variable Search Priority Sequence

Specifying a variable name to access a variable, searches variables in the following
sequence.

(1)

Local

Variables

(2) Current Folder Variables

(3) “library” Folder Variables

• Multiple variables with the same name can exist simultaneously as a local variable, as

a variable in the current folder, and as a variable in the “library” folder. In this case, the
ClassPad searches folders according to the sequence shown above and accesses the first
instance of the variable that it finds. If you want to access such a variable when it occurs
lower in the above priority sequence, you need to specify the folder name along with the
variable name as shown in “Specifying a Variable in a Particular Folder” below.

• If a variable you specify cannot be found, it is treated as an “undefined variable”.
• Note that the “system” folder is not included in the above variable search. When accessing

a variable in the system folder, you need to specify the variable name only, without
specifying the folder name.

Tip

• Local variables exist only as long as the program or user-defined function for which it was created

in being executed.

• When a variable search is required during a subroutine called by a program or user-defined

function, the local variable search range includes only the local variables of the subroutine
currently being executed.

• For information about programs and user-defined functions, see Chapter 12.

• Only local variables and current folder variables are searched in the case of an operation that

stores variable data or a command that performs an operation on a variable (like “DelVar”).
Normally, “library” folder variables are not searched. If you want to include “library” folders in the
search, you need to specify the “library” folder as the variable location as explained below.

I Specifying a Variable in a Particular Folder

You can access a variable located inside the “main” folder, “library” folder, or a particular
user folder by specifying the folder name along with the variable name. Use the following
syntax when specifying a folder name:

\

Example: To specify variable “abc” located in the “main” folder

main\abc