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

Re: while loop grammar question



On Sun, Dec 8, 2024, at 4:14 PM, Mark J. Reed wrote:
> To be clear, not  even the last command in a condition need be a test 
> expression; `while a; bunch; of; commands; are; true: do` is a 
> perfectly cromulent infinite loop. :)

In general yes, but the short forms do have restrictions on the
final command.  So this doesn't parse:

	while true
	print testing
	false {
		print looping
	}

But this does:

	while true
	print testing
	[[ ! x ]] {
		print looping
	}

-- 
vq




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