Implicit Return
- Like Scheme, the return value of the function is the last thing evaluated:
$foo = 40;
$bar = 6;
sub foo_plus_bar {
print "Wondering what foo plus bar is?\n";
$foo + $bar;
}
| CPU: Perl, Fall 2005 | Perl, Week 3: More Arrays, Context, Subroutines, Lexical Variables | #42 |
$foo = 40;
$bar = 6;
sub foo_plus_bar {
print "Wondering what foo plus bar is?\n";
$foo + $bar;
}
| Copyright © 2005 Ian Langworth |