Visara Master Console Center Scripting Guide Manuel d'utilisateur Page 38

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 262
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 37
Chapter 3 Script Syntax
Scripting Guide 38
Arrays
Using and Naming Arrays
There are two types of arrays, integer arrays and string arrays.
Integer arrays are prefixed with a %. String arrays are prefixed by a
$.
The maximum number of elements per array is limited only by
available memory. Array elements are dynamically allocated—no size
declaration, no limits, no reallocation needed.
The syntax for arrays is:
ArrayName[ ArrayIndex].
Array elements are accessed by surrounding the array index with
square brackets “[ ]”.
Arrays are indexed by a numeric expression (normal array) or a
character expression (associative array). The only limitation to index
expressions is that the index cannot be the direct return value of a
script. For example, the following statement:
$Var := $Array[ Script()]
must be written as
%Index := Script()
$Var := $Array[ %Index]
to make clear what is the index type (array type). This assumes
Script() returns a numeric value and $Array is a normal array.
An array’s indexing type (normal or associative) is determined by the
first use of the array encountered by the compiler (processed from
script beginning to end).
Arrays can be copied to new arrays just like any other variable, if the
destination array is new or of the same structure as the source:
$A[1] := “Hello”
$A[2] := “World”
$B := $A
// $B[1] will contain “Hello” and
// $B[2] will contain “World”
Vue de la page 37
1 2 ... 33 34 35 36 37 38 39 40 41 42 43 ... 261 262

Commentaires sur ces manuels

Pas de commentaire