This shows you the differences between two versions of the page.
en:function [2016/01/01 22:41] 127.0.0.1 external edit |
en:function [2020/02/28 10:46] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Function (Statement) ===== | ||
- | ==== Format ==== | ||
- | **function** function_name ( // | ||
- | (tab)// | ||
- | **end function** | ||
- | |||
- | **function** function_name$ ( // | ||
- | (tab)// | ||
- | **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> | ||
- | |||
- | ==== History ==== | ||
- | |0.9.9.1|New To Version| |