ErosOlmi
01-06-2007, 11:24
Next preview version will have the possibility to assign multiple values in one go to array elements.
So the following syntax will be accepted:
ElementNumber = 1
MyArray(ElementNumber) = FirstValue, SecondValue, ..., nthValue
thinBasic will assign FirstValue to MyArray(ElementNumber), SecondValue to MyArray(ElementNumber + 1) and so on. Equivalent code is
MyArray(1) = FirstValue
MyArray(2) = SecondValue
...
MyArray(nth) = nthValue
This will be possible with any numeric, string or variant array.
An example example using variant array:
uses "console"
Dim ArrayNamesAndValues(4) As variant
Dim Counter as long
ArrayNamesAndValues(1) = 1, "ABC", 123, "Hello world"
for Counter = 1 to 4
console_writeline ArrayNamesAndValues(Counter)
next
console_waitkey
I'm still working on this new feature adding error checking (mainly bounds checking).
It will work also on multi dim array but only with one index following colum order. So for example if MyArray is a 4 x 3 matrix (4 lines, 3 colums) MyArray(5) will be in reality MyArray(2,1).
Hope you will like it.
Eros
So the following syntax will be accepted:
ElementNumber = 1
MyArray(ElementNumber) = FirstValue, SecondValue, ..., nthValue
thinBasic will assign FirstValue to MyArray(ElementNumber), SecondValue to MyArray(ElementNumber + 1) and so on. Equivalent code is
MyArray(1) = FirstValue
MyArray(2) = SecondValue
...
MyArray(nth) = nthValue
This will be possible with any numeric, string or variant array.
An example example using variant array:
uses "console"
Dim ArrayNamesAndValues(4) As variant
Dim Counter as long
ArrayNamesAndValues(1) = 1, "ABC", 123, "Hello world"
for Counter = 1 to 4
console_writeline ArrayNamesAndValues(Counter)
next
console_waitkey
I'm still working on this new feature adding error checking (mainly bounds checking).
It will work also on multi dim array but only with one index following colum order. So for example if MyArray is a 4 x 3 matrix (4 lines, 3 colums) MyArray(5) will be in reality MyArray(2,1).
Hope you will like it.
Eros