Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: why not promote the plague ? (brace|rc|alternative|modern) syntax
On Sat, Dec 14, 2024, at 6:36 PM, Lawrence Velázquez wrote:
> Other than the `for' variants, none of these (or the short forms
> below) requires parentheses _per se_. What they require is that
> their conditions be, as zshmisc(1) so vaguely puts it, "suitably
> delimited". These are all valid:
>
> % if ! ( true ) { print true }
> % if [[ x ]] && { false } { print true }
> % if true; ! [[ x ]] { print true }
> % if print ignored | (( 0 )) { print true }
> %
But:
% if { true } { print true }
true
% if f() { not executed yet } { print true }
true
% if () { true } { print true }
zsh: parse error near `}'
Anonymous functions accept arguments, so the end of an anonymous
function _body_ does not delimit the anonymous function _command_.
--
vq
Messages sorted by:
Reverse Date,
Date,
Thread,
Author