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

Marc Chantreux <[email protected]>
Newsgroups gmane.comp.shells.zsh.user
Message-ID <Z1y9zfe41McIKVrl@prometheus>
On Fri, Dec 13, 2024 at 08:50:48PM +0100, Mikael Magnusson wrote:
> It looks like there's some confusion in this thread about alternate syntax:
> for a (foo bar baz) { echo $a }

you don't even need braces. so actually both are working by default:

	for a in foo bar baz; echo $a
	for a ( foo bar baz ) echo $a

this works

	integer i=10; while (( --i ))  echo $i

this doesn't

	integer i=10; while (( --i ));  echo $i

both of them work

	integer i=10; repeat 10; echo $[i--]
	integer i=10; repeat 10 echo $[i--]

> But for what it's worth, short_loops is unfortunately set by default.

TIL this. thanks!

> If you don't want to use it, I recommend sticking a setopt
> noshortloops in your .zshrc to catch more typos.

as this is a default behavior and it doesn't hurt me, I'll keep it that
way.

regards

-- 
Marc Chantreux
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.