parrotcode: testing functions | |
Contents | Language Implementations | Pipp |
t/php/functions.t - testing functions
perl t/harness t/php/functions.t
Defining and calling functions.
sub say_count( $count ) { print "count: $count\n"; }
say_count( 123456 );
sub thrice( $a is rw ) { print "$a times 3 is "; $a = $a * 3; print "$a.\n"; }
my $a = 22; print "before: $a\n"; thrice( $a ); print "after: $a\n";
sub echo_count( $count ) { print "count: $count\n"; }
echo_count( 123456 );
sub func_with_return( ) { return 100; }
my $a = func_with_return(); print "$a\n";
|