Re: Re[2]: why not promote the plague ? (brace|rc|alternative|modern) syntax

Mikael Magnusson <[email protected]>
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAHYJk3Q-L2m7yNhHs-1SRGLOgVnyBAYgktQVHDFUpaxHGDy4PA@mail.gmail.com>
On Sat, Dec 14, 2024 at 9:25 PM Mark J. Reed <[email protected]> wrote:
>
>
>
> On Sat, Dec 14, 2024 at 3:11 PM Vadim Zeitlin <[email protected]> wrote:
>>
>>
>>  But I think it would make sense to add that there is also the
>>
>>         for var in val1 val2 val3; command
>>
>> syntax which is not covered by any of the options above,
>
>
> Thanks, I did overlook that. It is valid only with SHORT_LOOPS set, and is the only way I know of to use in without also using do.

You can actually mix and match the syntaxes (even without short_loops),
% for var in val1 val2 val3; { echo $var }
val1
val2
val3
% for var (val{1..3}); do echo $var; done
val1
val2
val3

etc. But I probably wouldn't recommend it.

-- 
Mikael Magnusson
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.