ARRAY
A = ARRAY [s | expr]
Creates a ARRAY or MAP variable from the given string s
or expression expr
. The ARRAY command supports JSON
(Javascript object notation) syntax. The MAP provides value-key pair
access along with array or dotted notation.
See STR for converting a MAP variable into a JSON string.
Example 1: JSON string to MAP
array("{Name: Alice, Age: 20}")
a = print a
print a.Name + " is " + a.Age + " years old"
' Output:
' {"Age":20,"Name":"Alice"}
' Alice is 20 years old
Example 2: JSON with nested MAP
Array("{x:1, y:3, down:{x:4, y:7}}")
a = print a ' Output: {"down":{"y":7,"x":4},"x":1,"y":3}
Example 3: Array string to array
Array("[1,2,3]")
a = print a ' Output: [1,2,3]
Code samples using ARRAY
006 arrays+.bas
2048.bas
2048.bas
7gables.bas
agendus.bas
bairstow.bas
base64.bas
blackbox.bas
Blackbox.bas
checkers.bas
checkers.bas
chess.bas
chess.bas
colors1.bas
conrec-sb-v01.bas
duckduckgo.bas
ellipse.bas
fire.bas
first factors mga.bas
g1 Life.bas
g2 Life.bas
g3 Life.bas
g4 Life.bas
g5 Life.bas
g6 Life.bas
heap.bas
image_demo.bas
index.bas
insert delete test.bas
Data
APPEND
ARRAY
DATA
DELETE
DIM
EMPTY
ERASE
INSERT
ISARRAY
ISDIR
ISFILE
ISLINK
ISMAP
ISNUMBER
ISSTRING
LBOUND
LEN
READ
REDIM
RESTORE
SEARCH
SORT
SWAP
UBOUND
If there is insufficient information on this page and you wish learn more about ARRAY,
please send an email to smallbasic@gmail.com. You can help to improve information about
ARRAY by submitting a pull request,
click View Source for details. Note, an offline language reference text file is also available - see the Download section.