Hi all,
How can i clear a dynamic array?
I explain it:
I have a dynamic array inside a while.
To clear de array I use Array[0]=’’.
can any one help me.
Regards,
Madhu.
Hello Madhu,
Array indexes begin at 1. The first item in the array is called [1], the second [2], and so on. The syntax for accessing an array element is:
ArrayItemReference = ArrayVariable [ Index ]; where ArrayVariable is the identifier of the array, and Index is the number of the array element. Index can be an integer expression.
In X++, item zero[0] is used to clear the array. Assigning a value to index 0 in an array resets all elements in the array to the default value. For example,
intArray[0] = 0; //Resets all elements in int Array.
strArray[0] = ‘’; //Resets all elements in str Array.
You can use this to reset all elements of a fixed-length as well as a dynamic array to the default value.