## Use Array Compound Assignment Syntax; Otherwise Use Length as Index
You have to append to an array using either the compound assignment syntax (e.g. `foo=("elem1" ...)` or an array index.
### Array Compound Assignment Syntax
The form with parentheses allows you to insert one or more elements at a time, and is (arguably) easier to read. For example:
# start with a clean slate
unset you
for i in "fgt" "fe" "ger"; do
you+=("$i")
done
printf "%s\
" "${you[@]}"
This yields the values you'd expect:
>
> fgt
> fe
> ger
>
### Insert at Index _Length_
You can get similar results by assigning to an index. For example:
unset you
for i in "fgt" "fe" "ger"; do
you[${#you[@]}]="$i"
done
printf "%s\
" "${you[@]}"
This second example works because Bash arrays are zero-indexed, so the _length_ of the array is also the next available index that should be assigned when appending.