docs: update

This commit is contained in:
Dylan Araps
2018-06-14 17:50:46 +10:00
parent 171105b9fb
commit d7193d06ef
2 changed files with 17 additions and 2 deletions

View File

@@ -243,7 +243,11 @@ again.
```sh
arr=(a b c d)
printf '%s\n' "${arr[$((i==${#arr[@]}-1?i=0:++i))]}"
cycle() {
printf '%s ' "${arr[${i:=0}]}"
((i=i>=${#arr[@]}-1?0:++i))
}
```
@@ -253,7 +257,11 @@ This works the same as above, this is just a different use case.
```sh
arr=(true false)
printf '%s\n' "${arr[$((i==${#arr[@]}-1?i=0:++i))]}"
cycle() {
printf '%s ' "${arr[${i:=0}]}"
((i=i>=${#arr[@]}-1?0:++i))
}
```