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

ForNext

Only Do What Only You Can Do

144. pass number or string by reference

VBScript

JScript

Perl

sub foo {
  $_[0] += 1;
  $_[1] .= "ly";
}

my $n = 7;
my $s = "hard";
foo($n, $s);

PHP

function foo(&$x, &$y) {
  $x += 1;
  $y .= "ly";
}

$n = 7;
$s = "hard";
foo($n, $s);

Python

not possible







Ruby

not possible







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