User Tools

Site Tools


en:function

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:function [2016/08/13 09:06]
admin
en:function [2020/02/28 10:46]
Line 1: Line 1:
-===== Function (Statement) ===== 
  
-==== Format ==== 
-**function** function_name ( [[functionvariablelist|function_variable_list]] )\\ 
-(tab)[[programsyntax|statement(s)]]\\ 
-**end function** 
- 
-==== Description ==== 
-Create a function that will receive zero or more values, process those values and return either a value.  Strings, integers, and floating point numbers may be returned by a function and are returned by executing a [[Return|Return]] statement with a value ovby assigning the name of the function a value and allowing the //End Function// statement to be executed.  All variables used within the function will be local to the function and will not change the values in the calling code. 
- 
-Function variables may a list of zero or more, comma separated, variables.  Arrays and variables may be passed by reference using the [[Ref|Ref]] definition. 
- 
-Functions can be defined anywhere in your program, and can not be defined within another function, [[Subroutine|Subroutine]] or control block ([[if|If/Then]], [[do|Do/Until]], ...) 
- 
-==== Example ==== 
- 
-<code> 
-print double("Hello") 
-print double(9) 
-print triple(3) 
-end 
- 
-function double(a) 
-   double = a + a 
-end function 
- 
-function triple(b) 
-   return b * 3 
-end function 
-</code> 
-will display\\ 
-<code> 
-HelloHello 
-18 
-9 
-</code> 
-==== See Also ==== 
-{{page>en:start#Program Control&noheader}} 
- 
-==== History ====  
-|0.9.9.1|New To Version| 
-|1.99.99.|Removed variable/function type| 
en/function.txt ยท Last modified: 2020/02/28 10:46 (external edit)