ForNext
Only Do What Only You Can Do
138. function declaration
Hyperpolyglot Interpreted Languages: PHP, Perl, Python, Ruby より (2012.05.08)
VBScript
JScript
Perl
sub add { $_[0] + $_[1] } sub add { my ($a, $b) = @_; $a + $b; }
PHP
function add($a, $b) { return $a + $b; }
Python
def add(a, b): return a+b
Ruby
def add(a, b) a+b end parens are optional and customarily omitted when defining functions with no parameters