Function definition: Difference between revisions

Content added Content deleted
(Dialects of BASIC moved to the BASIC section (uBASIC was twice - merged).)
Line 614: Line 614:
c = a * b
c = a * b
= c</syntaxhighlight>
= c</syntaxhighlight>

=== {{header|Chipmunk Basic}} ===
<syntaxhighlight lang="basic">
10 rem Function definition

20 rem ** 1. Function defined as formula
30 def fnmultiply(a, b) = a * b

40 rem ** Call the functions
50 print multiply(3,1.23456)
60 print fn multiply(3,1.23456)
70 end

200 rem ** 2. Function defined as subroutine returning a value
210 sub multiply(a,b)
220 multiply = a*b
230 end sub
</syntaxhighlight>
{{out}}
<pre>
3.70368
3.70368
</pre>


==={{header|Commodore BASIC}}===
==={{header|Commodore BASIC}}===