Function definition: Difference between revisions

m
no edit summary
mNo edit summary
 
Line 1,219:
return a*b;
}</syntaxhighlight>
 
=={{header|Chapel}}==
 
<syntaxhighlight lang="text">
 
proc multiply(a, b)
{
return a * b;
}
</syntaxhighlight>
 
Can require that the two arguments be of the same type.
<syntaxhighlight lang="text">
proc multiply(a : ?t ... 2)
{
return a(0) * a(1)
}
</syntaxhighlight>
Will work on any type where the * operator is defined.
 
=={{header|ChucK}}==
6

edits