Tuto WEBDEV 25

Part 13: The WLanguage basics 439 Filling an array and accessing the elements During its declaration, the array is empty. The Add function is used to add elements 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" Tip Fast array initialization To initialize an array, you also have the ability to use the following syntax: // Declares an array arrDay is array of strings // Initialization with // the names of the days of week arrDay = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] See the online help for more details (keyword: "Array"). Advanced arrays Advanced arrays are also available: array with several dimensions, array of arrays, associative array, array of structures, array of objects, ... See the online help for more details (keyword: "Array").

RkJQdWJsaXNoZXIy NDQ0OA==