in reply to Re^16: printing unitialized value of the 'do BLOCK' (EXPRESSION vs TERM vs STATEMENT)
in thread printing unitialized value of the 'do BLOCK'
I read up the WP pages on statement and expression and it becomes clear that it's far easier to make a distinction in languages like C.
But Perl took also a lot from Lisp, where everything is an expression returning a value.
So Perl's if is an expression, especially when executed in a scalar or list context due to a surrounding do.
And it's also a statement, because
OTOH does A and B (= do { if (A) {B} } ) have the side-effect of flow-control, because it's short-circuiting.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
FootballPerl is like chess, only without the dice
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^18: printing unitialized value of the 'do BLOCK' (EXPRESSION vs TERM vs STATEMENT)
by ikegami (Patriarch) on Dec 28, 2019 at 13:57 UTC | |
by LanX (Saint) on Dec 28, 2019 at 17:20 UTC | |
by ikegami (Patriarch) on Dec 28, 2019 at 17:33 UTC | |
by LanX (Saint) on Dec 28, 2019 at 17:53 UTC | |
by ikegami (Patriarch) on Dec 28, 2019 at 23:25 UTC | |
|