Tuto WINDEV 25

54 Part 2: The WLanguage basics Details of another variable type: the arrays The arrays are a common type of variable. An array is a structured type that is used to group a set of elements of the same type. Each array element can be directly accessed by its subscript. Specific WLanguage functions are used to handle the arrays and their elements. These functions start with "Array". Declaration The declaration of an Array variable is performed as follows: <Array name> is array of <Type of array elements> For example: arrString is array of strings arrInt is array of int Filling an array and accessing the elements During its declaration, the array is empty. The elements are added by Add via the following syntax: Add(<Array name>, <Element value>) To access the array elements, use the following syntax: <Array name> [<Element subscript>] Important The subscripts of array elements start from 1. Example: // Create an array of strings MyArray is array of strings // Add elements Add(MyArray, "WINDEV") Add(MyArray, "WEBDEV") Add(MyArray, "WINDEV Mobile") // Display the content of third element Trace(MyArray[3]) // Displays "WINDEV Mobile"

RkJQdWJsaXNoZXIy NDQ0OA==