1 |
# These are really lists |
2 |
|
3 |
#### basic array |
4 |
var x = %(1 2 3) |
5 |
write len=$len(x) |
6 |
## STDOUT: |
7 |
len=3 |
8 |
## END |
9 |
|
10 |
#### string array with command sub, varsub, etc. |
11 |
shopt -s oil:all |
12 |
|
13 |
var x = 1 |
14 |
var a = %($x $(write hi) 'sq' "dq $x") |
15 |
write len=$len(a) |
16 |
write @a |
17 |
## STDOUT: |
18 |
len=4 |
19 |
1 |
20 |
hi |
21 |
sq |
22 |
dq 1 |
23 |
## END |
24 |
|
25 |
#### printing type of array with pp and = |
26 |
var b = %(true) |
27 |
# pp cell should show the type of the object? |
28 |
pp cell b |
29 |
= b |
30 |
|
31 |
var empty = %() |
32 |
pp cell empty |
33 |
= empty |
34 |
|
35 |
## STDOUT: |
36 |
Array[Bool] |
37 |
Array[???] # what should this be? |
38 |
## END |