Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Short loops?
- X-seq: zsh-workers 2927
- From: <hzoli@xxxxxxxxxxxx> (Zoltan T. Hidvegi)
- To: schaefer@xxxxxxx
- Subject: Re: Short loops?
- Date: Wed, 26 Feb 1997 11:10:56 -0500 (EST)
- Cc: zsh-workers@xxxxxxxxxxxxxxx
- In-reply-to: <970225181321.ZM13319@xxxxxxxxxxxxxxxxxxxxxxx> from Bart Schaefer at "Feb 25, 97 06:13:21 pm"
Bart Schaefer wrote:
> Nobody responded to my message to zsh-users about `while LIST { LIST }`
> syntax. Is this syntax broken by accident or on purpose?
Sorry for the silence. I've got a new job and moved to the US, that's why
I was a bit silent recently. I'd like to buy a computer at home within a
few weeks and than I'll have more time to work on zsh again.
So, the while syntax is not broken. As you write above,
while LIST { LIST } works. But
while foo ; { bar }
is just while LIST because foo ; { bar } is a list in itself. The above
syntax only works if zsh can detect the end of the LIST before reading the
{.
This works:
integer i=0
while ((i++ < 10)) { echo $i }
That's because ((i++ < 10)) { echo $i } is not a valid listso zsh can
detect that the list ends in )). Similarily [[ ... ]] { ... } works as
well. It is the same as
if [[ ... ]] then works without a semicolon before then but if true; then
doesn't.
Zoltan
Messages sorted by:
Reverse Date,
Date,
Thread,
Author