Arrays?
-
- Posts: 353
- Joined: 07 Dec 2018, 15:04
Arrays?
I could not find any documentation regarding arrays (either numeric or string). Do they exist?
-
- Posts: 353
- Joined: 07 Dec 2018, 15:04
Re: Arrays?
For character arrays, you may use strings:
for string arrays, you may use the { } syntax, see the example:
Menu / Demos / Basic 4
for generic arrays, the standard Dim keyword is supported, but this feature is currently experimental (5.42 or newer). It works well, but there are two limitations: all arrays are global, whole arrays cannot be passed as function parameters.
Some examples:
arrays will be actually released as "lists", the following example is quite nice:
Code: Select all
filters = "LRRGGBB"
For i = 1 to Len(filters)
Print filters[i]
Next i
Menu / Demos / Basic 4
for generic arrays, the standard Dim keyword is supported, but this feature is currently experimental (5.42 or newer). It works well, but there are two limitations: all arrays are global, whole arrays cannot be passed as function parameters.
Some examples:
Code: Select all
Dim arr(10)
For i = 1 to 10
arr(i) = i*i
Next i
For i = 1 to 10
Print arr(i)
Next i
Code: Select all
Dim arr = {4, 5*5, "hel"+"lo", 0.5, Sqr(64)}
For i = 0 to 4
Print arr(i)
Next i
Re: Arrays?
How do one get the dimension of an array? Don't want to hardcode size in the script I am creating.Forum_2015 wrote: ↑07 Dec 2018, 22:07For character arrays, you may use strings:
for string arrays, you may use the { } syntax, see the example:Code: Select all
filters = "LRRGGBB" For i = 1 to Len(filters) Print filters[i] Next i
Menu / Demos / Basic 4
for generic arrays, the standard Dim keyword is supported, but this feature is currently experimental (5.42 or newer). It works well, but there are two limitations: all arrays are global, whole arrays cannot be passed as function parameters.
Some examples:
arrays will be actually released as "lists", the following example is quite nice:Code: Select all
Dim arr(10) For i = 1 to 10 arr(i) = i*i Next i For i = 1 to 10 Print arr(i) Next i
Code: Select all
Dim arr = {4, 5*5, "hel"+"lo", 0.5, Sqr(64)} For i = 0 to 4 Print arr(i) Next i
Code: Select all
Dim arr = {4, 5*5, "hel"+"lo", 0.5, Sqr(64)}
For i = 0 to arr.Dim() <==== error, also tried "Dim", "Len()", "Len", .... and many more options
Print arr(i)
Next i
/Rudi
Re: Arrays?
Hello,
the function to get the length of an array is: UBound(array)
For more information see the paragraph "Types and variables"
Fabio.
the function to get the length of an array is: UBound(array)
For more information see the paragraph "Types and variables"
Fabio.