Function definition: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 900: | Line 900: | ||
S-BASIC is unusual in that the function return value is assigned to the END statement that terminates the function. |
S-BASIC is unusual in that the function return value is assigned to the END statement that terminates the function. |
||
<syntaxhighlight lang="basic"> |
<syntaxhighlight lang="basic"> |
||
function multiply(a, b = |
function multiply(a, b = integer) = integer |
||
end = a * b |
end = a * b |
||
⚫ | |||
⚫ | |||
⚫ | |||
</syntaxhighlight> |
</syntaxhighlight> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
==={{header|True BASIC}}=== |
==={{header|True BASIC}}=== |
||
Line 2,954: | Line 2,964: | ||
end; |
end; |
||
end;</syntaxhighlight> |
end;</syntaxhighlight> |
||
=={{header|S-BASIC}}== |
|||
S-BASIC is unusual in assigning the return value of a function to its terminating END. |
|||
<syntaxhighlight lang="basic"> |
|||
rem - return the product of two integers |
|||
function multiply(a, b = integer) = integer |
|||
end = a * b |
|||
⚫ | |||
⚫ | |||
⚫ | |||
</syntaxhighlight> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Scala}}== |
=={{header|Scala}}== |