I did in Zsh:
array={geometry, analysis, topology, graph theory, calculus}
echo $array
and then I wanted to add word "math:" to each element like" math:calculus":
while (( i++ < 10)); { echo math:$array[i] }
But it does not work? Why?
|
I did in Zsh:
and then I wanted to add word "math:" to each element like" math:calculus":
But it does not work? Why? | |||
feedback
|
|
Works fine for me in zsh with the assignment changed from:
to
But zsh has tons of options that change its behavior. Maybe the output 'setopt' might help. | ||||
|
feedback
|
|
Welp, I'm going to go out on a limb here (because I don't accept that the supporting code is correct) and say that "echo math:$array[i]" is missing a dollar sign and should be "echo math:$array[$i]" | |||||
feedback
|
|
Iterating through an array works better with Also, I assume you don't want the commas to be included as part of the strings and you should use parentheses instead of curly braces for your array.
| |||
|
feedback
|
|
Just do:
or check | |||
|
feedback
|