13 lines
304 B
Raku
13 lines
304 B
Raku
A prototype tells declare what types of arguments the subroutine should get.
|
|
|
|
my $a=5;
|
|
my $b=6;
|
|
my $c=7;
|
|
@list=(100,200,300);
|
|
sub myadd($$) { # myadd requires two scalar arguments
|
|
my($x, $y)=@_;
|
|
print $x + $y,"\n";
|
|
}
|
|
myadd($a, $b); # Okay
|
|
myadd(5, 4); # Okay
|