This shows you the differences between two versions of the page.
el:function [2016/01/01 22:39] |
el:function [2020/02/28 10:46] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Function ===== | ||
+ | ==== Format ==== | ||
+ | **function** functionname ( //variable list// )\\ | ||
+ | // | ||
+ | **end function** | ||
+ | |||
+ | **function** functionname$ ( //variable list// )\\ | ||
+ | // | ||
+ | **end function** | ||
+ | |||
+ | ==== Description ==== | ||
+ | Create a function that will receive zero or more values, process those values and return either a numeric or string value. | ||
+ | |||
+ | In many structured languages the return value of a function is set using the [[return|Return]] statement. | ||
+ | |||
+ | Subroutine variables may a list of zero or more, comma separated, numeric or string variables. | ||
+ | |||
+ | Functions should be defined at the bottom of your program, and can not be defined within another function, [[Subroutine|Subroutine]] or control block ([[if|If/ | ||
+ | |||
+ | ==== Example ==== | ||
+ | |||
+ | < | ||
+ | print double$(" | ||
+ | print triple(3) | ||
+ | end | ||
+ | |||
+ | function double$(a$) | ||
+ | | ||
+ | end function | ||
+ | |||
+ | function triple(b) | ||
+ | | ||
+ | | ||
+ | | ||
+ | end function | ||
+ | </ | ||
+ | will display\\ | ||
+ | < | ||
+ | HelloHello | ||
+ | 9 | ||
+ | </ | ||
+ | ==== See Also ==== | ||
+ | {{page> | ||
+ | |||
+ | ==== New To Version ==== | ||
+ | 0.9.9.1 |