Difference between revisions of "Gosub"

From Wiki
Jump to: navigation, search
Line 1: Line 1:
−
__NOTOC__
+
{{command header|Flow Control}}
−
== gosub ==
+
{{body|gosub {sub name} {param1, param2, ...}|The ''gosub'' command transfers the execution to a [[sub]] with the name given by the parameter.
−
'''Flow Control'''
+
−
=== Synopsis ===
+
−
gosub {sub name} [param1, param2, ...]
+
  
−
=== Description ===
+
Parameters can be added after the sub name. They will be transfered in the variables %1, %2, and so on. The variable %0 holds the number of parameters passed.}}
−
The [[gosub]] command transfers the execution to a [[sub]] with the name given by the parameter.
+
−
 
+
−
Parameters can be added after the sub name. They will be transfered in the variables %1, %2, and so on. The variable %0 holds the number of parameters passed.
+
  
 
==== Example ====
 
==== Example ====
Line 21: Line 15:
 
</pre>
 
</pre>
  
−
'''NOTE:'''
+
{{footer}}
−
Subs in EUO 1.5 works little bit differently, better.
+
−
Correct way, to build up sub in 1.5 looks like this.
+
−
<pre>
+
−
sub UnaBeatsEveryone
+
−
{
+
−
;here you can praise me
+
−
;and here you can place code
+
−
  return
+
−
}
+
−
</pre>
+
−
 
+
−
This way EUO knows where the sub ends, even there is multiple returns in sub.
+
−
 
+
−
=== See Also ===
+
−
{|
+
−
| Width=200px | [[sub]] || Width=200px | [[return]]
+
−
|}
+
−
----
+
−
{|
+
−
| Width=200px | [[Main_Page]] || Width=200px | [[Documentation]] || Width=200px |
+
−
[[Documentation#Flow_Control|Flow Control]]
+
−
|}
+

Revision as of 10:41, 27 August 2005

Synopsis

gosub {sub name} {param1, param2, ...}

Description

The gosub command transfers the execution to a sub with the name given by the parameter.

Parameters can be added after the sub name. They will be transfered in the variables %1, %2, and so on. The variable %0 holds the number of parameters passed.

Example

gosub s7IsGreaterThan CEO RK
; %1 = CEO
; %2 = RK
; %0 = 2
sub s7IsGreaterThan CEO RK
   display ok %1 && %2 even %0 , gether < una
return

See also

Main Page Documentation