Function definition: Difference between revisions
Content added Content deleted
Langurmonkey (talk | contribs) |
LalaithMeren (talk | contribs) mNo edit summary |
||
Line 1,219: | Line 1,219: | ||
return a*b; |
return a*b; |
||
}</syntaxhighlight> |
}</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}}== |
=={{header|ChucK}}== |