-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
POSIX states that a function body is a compound command. This means that, among others, the following are legal (and widely supported):
% foo() { echo hello; }
% foo
hello
% bar() ( echo hello )
% bar
hello
% xyzzy() if true; then echo wizard; else echo muggle; fi
% xyzzy
wizard
% frobnitz() for i in $(seq 3); do echo $i; done
% frobnitz
1
2
3Some shells also accept a simple command (in addition to compound) as the body. For instance, in dash and zsh:
% baz() echo hello
% baz
helloHowever, flash's Parser::parse_function_definition() is too restrictive and only accepts a function body if wrapped in curly braces.
Metadata
Metadata
Assignees
Labels
No labels