home > 比較編 > Perl, PHP, Python, Ruby > functions >

ForNext

Only Do What Only You Can Do

138. function declaration

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

PowerShell

Scala

F#

C

C++

C++Builder

VC++

C#

Java

Objective-C

D

VB

VB.NET

Delphi

Ada

PL/SQL

T-SQL

関数型

inserted by FC2 system