User Tools

Site Tools


en:subroutine

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:subroutine [2016/08/08 10:54]
admin
en:subroutine [2020/02/28 10:46] (current)
Line 2: Line 2:
  
 ==== Format ==== ==== Format ====
-**subroutine** subroutine_name ( //variable_list// )\\ +**subroutine** subroutine_name ( [[functionvariablelist|function_variable_list]] )\\ 
-(tab)//statement(s)//\\ +(tab)[[programsyntax|statement(s)]]\\
-**end subroutine** +
- +
-**subroutine** subroutine_name$ ( //variable_list// )\\ +
-(tab)//statement(s)//\\+
 **end subroutine** **end subroutine**
  
Line 13: Line 9:
 Create a subroutine (or subprogram) that will receive zero or more values and process those values.  A subroutine does not return a value back to the user, it just does what you want it to do.  Execution of a subroutine will terminate and control will be returned to the "[[call|call]]ing" program when a [[Return|Return]] statement is executed or by allowing the //End Subroutine// statement to be reached.  All variables used within the subroutine, that have not been previously declared as [[global|Global]], will be local to the subroutine and will not change the values in the calling code. Create a subroutine (or subprogram) that will receive zero or more values and process those values.  A subroutine does not return a value back to the user, it just does what you want it to do.  Execution of a subroutine will terminate and control will be returned to the "[[call|call]]ing" program when a [[Return|Return]] statement is executed or by allowing the //End Subroutine// statement to be reached.  All variables used within the subroutine, that have not been previously declared as [[global|Global]], will be local to the subroutine and will not change the values in the calling code.
  
-Subroutine variables may a list of zero or more, comma separated, numeric or string variables.  Arrays and variables may be passed by reference using the [[Ref|Ref]] definition.+Subroutine variables may a list of zero or more, comma separated, variables.  Arrays and variables may be passed by reference using the [[Ref|Ref]] definition.
  
-Subroutines should be defined at the bottom of your program, and can not be defined within another [[function|Function]], [[Subroutine|Subroutine]] or control block ([[ifthen|If/Then]], [[dountil|Do/Until]], ...)+Subroutines should be defined anywhere on your program, but can not be defined within another [[function|Function]], [[Subroutine|Subroutine]] or control block ([[ifthen|If/Then]], [[dountil|Do/Until]], ...)
  
 ==== Example ==== ==== Example ====
en/subroutine.1470675266.txt.gz · Last modified: 2020/02/28 10:46 (external edit)