Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

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



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




Messages sorted by: Reverse Date, Date, Thread, Author