Difference between revisions of "Return"

From Wiki
Jump to: navigation, search
(Synopsis)
Line 1: Line 1:
__NOTOC__
+
{{command header|Flow Control}}
== return ==
+
{{body|return { expression }|The ''return'' command transfers the execution back to where the [[sub]] was called using [[gosub]].
'''Flow Control'''
+
=== Synopsis ===
+
[[return]] [expression]
+
  
=== Description ===
+
providing a variable or expression to ''return'' will put the given value into the [[result]] system variable.}}
The [[return]] command transfers the execution back to where the [[sub]] was called using [[gosub]].
+
 
+
Placing something after [[return]] will put that value into the [[#result]] system variable.
+
  
 
==== Example ====
 
==== Example ====
Line 24: Line 18:
 
</pre>
 
</pre>
  
=== See Also ===
+
{{footer}}
{|
+
| Width=200px | [[sub]] || Width=200px | [[gosub]]
+
|}
+
----
+
{|
+
| Width=200px | [[Main_Page]] || Width=200px | [[Documentation]] || Width=200px |
+
[[Documentation#Flow_Control|Flow Control]]
+
|}
+

Revision as of 10:31, 27 August 2005

Synopsis

return { expression }

Description

The return command transfers the execution back to where the sub was called using gosub.

providing a variable or expression to return will put the given value into the result system variable.

Example

gosub makeLowerCase #charname
event macro 1 0 my name is #result
halt

;The following sub takes the first parameter
;makes it lowercase, and then returns the
;lowercase version.
sub makeLowerCase
	str lower %1
return #strRes    ; the lowercase version of %1 is now stored in #result and control is returned to the main script.

See also

Main Page Documentation