Changes

Jump to: navigation, search

Locomotive BASIC

7 bytes added, 19:55, 24 May 2012
/* FN */
==== <code>FN</code> ====
:BASIC allows the program to define and use simple value returning functions. DEF FuNction is the definition part of this mechanism and creates program-specific function which works within the :program in the same way as a function such a COS operates as a built-in function of BASIC. It may be invoked throughout the program. Variable types must be consistent and the DEF FN :command should be written in part of the program outside the execution loop.
:Syntax : DEF FN<name>[(<formal parameters>)]=<general expression>
:Example: ''"with the definition of..."''
<pre>
10 gn=9.80665
40 PRINT "...after";t;"seconds your dropped stone falls";FNgrv;"metres"
</pre>
:''"the results are..."''
<pre>
:...after 5 seconds your dropped stone falls 122.58315 metres
</pre>
205
edits