GoFiler Legato Script Reference
Legato v 1.5d Application v 5.25a
|
Table of Contents | < < Previous | Next >> |
Chapter Three — Data Types and Operators (continued)
The scope of a variable refers to the context within which it was defined. On a practical level, this implies its availability to functions and operations throughout a script. Scope can be considered at two levels: global, local and object.
Globally defined variables are available to every function and subroutine within a script. They are defined at the lowest level (outside of any particular function). They last the duration of the script’s execution, including all function calls within that script.
Globally defined variables are not available to other scripts or externally called programs.
3.2.3 Local
Locally defined variables are available to only the function in which they are defined. They last the duration of the function’s execution, including throughout the execution of functions called from within the originating function. They are not directly available to these sub functions, however, unless passed to them as a function parameter. If local handles and variables are not explicitly released, they are closed and released when the function exits. All declared variables are processed at the start of function execution, therefore, there is no economy in declaring variables inline. Inline declarations should be used for coding clarity only.
3.2.4 Object
Variables defined in an object should be considered as “belonging” to that object. They may be accessed by functions inside of the object. They may also be accessed by other functions that have access to the object according to the object’s scope.
3.2.5 Loop
Variables defined as part of a for loop iteration statement exist only throughout the execution of the loop. These are usually counting variables. For example:
for (i = 0; i < count; i++) {
... some code ...
}
In this case, i is initialized at the start, each pass 1 is added to i until i is equal to or larger than count.
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.