Work with arrays in zsh

$ a=(a b c)
$ echo $a
a b c
$ echo $a[1]
a
$ echo $a[2]
b

Iterate values:

$ for x in $a; do echo $x; done
a
b
c

Append values

$ a=()
$ a+=1
$ echo $a
1
$ a+=2
$ echo $a
1 2

Get the length of the array

$ echo ${#a[@]}
3
If you want to ask me a question or leave me a message add @bougui505 in your comment.