AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Sintaxis WLanguage / Declaración de variables
  • Passing a fixed array as parameter to a procedure
  • Declaring a fixed array member
  • Dimension of a fixed array
  • Fixed array of arrays, associative array, queue, stack, list
  • Limits: Elements of fixed array
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
A fixed array is an "advanced" type of array: the dimensions of this array are defined during the compilation and they cannot be modified.
The dimensions of a fixed array are defined during the compilation, only if the dimensions of this array correspond to:
  • an integer,
  • a constant that was created beforehand.
Otherwise, a WLanguage error occurs during the compilation of the project.
Reminder: An array is a structured type that is used to group a set of elements of the same type. Each element of the array can be accessed by its index.
It is recommended to use:
  • A fixed array to pass an array as parameter to the Windows API functions.
  • A dynamic array or a "simple" array when the size of the array must be modified during the program execution.
  • An associative array to store the elements indexed on any type of information.
Ejemplo
// Déclarer un tableau fixe
TableauClient is fixed array of 5 by 7 by 3 int
// Équivalent à: TableauClient est un tableau fixe de 5,7,3 entiers
// Faire référence à un tableau fixe
TableauClient[2,5,3] = 47
// Équivalent à: TableauClient[2][5][3] = 47
Sintaxis

Declaring a fixed array (syntax 1)


<Array name> is fixed array [ <Dimension 1> [,<Dimension 2> ... [,<Dimension 10>]] ] <Type of array elements>
Example:
tabChaîne is fixed array [10] strings
tabEntier is fixed array [5,9] int

Declaring a fixed array (syntax 2) Ocultar los detalles

<Array name> is fixed array of <Dimension 1> [by <Dimension 2> ... [by <Dimension 10>]] <Type of array elements>

OR

<Array name> is fixed array of <Dimension 1> [,<Dimension 2> ... [,<Dimension 10>]] <Type of array elements>
<Array name>:
Name of the array variable to declare.
<Dimension 1>...<Dimension 10>:
Dimension 1 to 10 of the array (integer value).
<Type of array elements>:
Type of the elements found in the array. See the different types of WLanguage.
WINDEVWindowsLinuxUniversal Windows 10 App Remark: The elements that make up the array can also be arrays, fixed arrays, associative arrays, queues, stacks or lists.
Remark: The an keyword is optional: it is an optional word.

Referring to an element in a fixed one-dimensional array:

<Array name>[Index1]

Referring to an element in a fixed two-dimensional array:

<Array name>[Index1, Index2]

OR

<Array name>[Index1][Index2]

Referring to an element in a fixed N-dimensional array:

<Array name>[Index1, ... , IndexN]

OR

<Array name>[Index1]...[IndexN]

Passing an array as parameter to a procedure: Ocultar los detalles

<Procedure name>(<Array name>)
<Array name>:
Name of the fixed array to use.
<Index1>:
Index of the element for the 1st dimension.
<Index2>:
Index of the element for the 2nd dimension.
<IndexN>:
Index of the element for the Nth dimension (N <= 10).
Remark: An array cannot be handled as a whole. For example, an array cannot be assigned to another array.
Observaciones

Passing a fixed array as parameter to a procedure

A fixed array can be passed as parameter to a procedure. To do so, use the following syntax:
<Nom de la procédure>(<Nom du tableau>)
For example:
TableauFournisseur is fixed array of 10 by 50 strings of characters
// Appel de la procédure AfficheTableau
AfficheTableau(TableauFournisseur)

Declaring a fixed array member

A "fixed array" member can be declared in:
  • A class. This fixed array is directly allocated in the memory area of this class.
  • A composite variable. This fixed array is directly allocated in the memory area of this composite variable.
  • A structure <Structure name>. This fixed array is directly allocated in the memory area of each <Structure name> variable.
For example:
Struct is Structure
n1 is int
nTab is fixed array on 2 int
n2 is int
END
MaStructure is Struct
Representation of the memory area of "MyStructure":
This memory representation is compatible with the Windows APIs. Therefore, a fixed-size array can be transmitted to a function of the Windows APIs.

Dimension of a fixed array

The Dimension function and the Occurrence property are used to get the number of elements in a fixed array.
Reminder: A fixed array cannot be resized.
WINDEVWindowsLinuxUniversal Windows 10 App

Fixed array of arrays, associative array, queue, stack, list

The following syntaxes are supported:
<variable> est un tableau fixe de 5 tableaux d'entiers
<variable> est un tableau fixe de 5 tableaux de 5 entiers

<variable> est un tableau fixe de 5 tableaux fixes de 5 entiers

<variable> est un tableau fixe de 5 tableaux associatifs d'entiers
<variable> est un tableau fixe de 5 tableaux associatifs (avecDoublon) d'entiers
<variable> est un tableau fixe de 5 tableaux associatifs (avecDoublon,wlEntier) d'entiers

<variable> est un tableau fixe de 5 files d'entiers

<variable> est un tableau fixe de 5 piles d'entiers

<variable> est un tableau fixe de 5 listes d'entiers

Limits: Elements of fixed array

  • A fixed array can include classes only if these classes have a constructor without parameter (or with optional parameters).
  • A fixed array cannot be made of composite variables.
  • Java A fixed array cannot be made of arrays.
  • Java You cannot create fixed arrays of classes or structures.
  • The size of a fixed array cannot exceed 2GB.
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Example Array [N,X]
//Example Array [N,X]

arrMensajes is array of 1 by 3 strings

i is int = 1

SQLExec(sQuery,ds)

WHILE SQLFetch(ds) = 0
arrMensajes[i,1] = SQLGetCol(ds, 1) //id
arrMensajes[i,2] = SQLGetCol(ds, 2) //numero
arrMensajes[i,3] = SQLGetCol(ds, 3) //mensaje
i++
Dimension(arrMensajes, i, 3)
END
BOLLER
17 07 2019

Última modificación: 06/03/2024

Señalar un error o enviar una sugerencia | Ayuda local