Function definition: Difference between revisions
Content added Content deleted
(→{header|Perl}: oops) |
(→{header|PHP}: er...) |
||
Line 18: | Line 18: | ||
} |
} |
||
=={header|PHP}== |
=={{header|PHP}}== |
||
function multiply( $a, $b ) |
function multiply( $a, $b ) |
||
{ |
{ |
Revision as of 21:26, 18 September 2007
![Task](http://static.miraheze.org/rosettacodewiki/thumb/b/ba/Rcode-button-task-crushed.png/64px-Rcode-button-task-crushed.png)
You are encouraged to solve this task according to the task description, using any language you may know.
A function is a body of code that returns a value. The value returned may depend on arguments provided to the function.
Write a definition of a function called "multiply" that takes two arguments and returns their product.
C
double multiply( double a, double b ) { return a * b; }
Perl
sub multiply( $$ ) { $a = shift; $b = shift; return $a * $b; }
PHP
function multiply( $a, $b ) { return $a * $b; }