Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
while loop grammar question
- X-seq: zsh-users 30115
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: while loop grammar question
- Date: Sat, 7 Dec 2024 18:48:42 -0800
- Archived-at: <https://zsh.org/users/30115>
- List-id: <zsh-users.zsh.org>
I probably know the answer to this somewhere in the back of my
head but right now it eludes me:
#!/usr/bin/zsh
for ((aa=1; aa < 10; aa++))
{
echo $aa
}
for ((aa=1; aa < 10; aa++)); do
{
echo $aa
}
done
aa=1
while (( aa < 10 )); do
{
echo $aa
let aa++
}
done
# return
aa=1
# This escape test isn't captured:
while (( aa < 10 ))
{
echo $aa
let aa++
}
... the for loop is fine with or without the 'do/done'
construction but the while loop requires it -- it runs on forever
otherwise. The echo and the increment are looped over but it
won't break. I must know this, but right now it has me scratching
my head.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author