<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.signature.net/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.signature.net/index.php?action=history&amp;feed=atom&amp;title=IB_Statements%2Freturn</id>
		<title>IB Statements/return - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.signature.net/index.php?action=history&amp;feed=atom&amp;title=IB_Statements%2Freturn"/>
		<link rel="alternate" type="text/html" href="http://wiki.signature.net/index.php?title=IB_Statements/return&amp;action=history"/>
		<updated>2026-04-20T10:22:39Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.16.0</generator>

	<entry>
		<id>http://wiki.signature.net/index.php?title=IB_Statements/return&amp;diff=382&amp;oldid=prev</id>
		<title>Badge: New page: '''RETURN statement'''   '''Syntax:'''  RETURN    '''Discussion:'''  The RETURN statement transfers program control to the statement immediately following the most recently invoked subrout...</title>
		<link rel="alternate" type="text/html" href="http://wiki.signature.net/index.php?title=IB_Statements/return&amp;diff=382&amp;oldid=prev"/>
				<updated>2009-05-21T11:02:57Z</updated>
		
		<summary type="html">&lt;p&gt;New page: &amp;#39;&amp;#39;&amp;#39;RETURN statement&amp;#39;&amp;#39;&amp;#39;   &amp;#39;&amp;#39;&amp;#39;Syntax:&amp;#39;&amp;#39;&amp;#39;  RETURN    &amp;#39;&amp;#39;&amp;#39;Discussion:&amp;#39;&amp;#39;&amp;#39;  The RETURN statement transfers program control to the statement immediately following the most recently invoked subrout...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''RETURN statement''' &lt;br /&gt;
&lt;br /&gt;
'''Syntax:'''  RETURN  &lt;br /&gt;
&lt;br /&gt;
'''Discussion:'''  The RETURN statement transfers program control to the statement immediately following the most recently invoked subroutine call. &lt;br /&gt;
&lt;br /&gt;
Subroutines are most commonly called with the GOSUB statement, although they may also be invoked with the ERRORSUB, ESCAPESUB, and MESSAGESUB statements, as well as the EXCPSUB= parameter. &lt;br /&gt;
&lt;br /&gt;
All subroutine calls in Internet Basic place a &amp;quot;return address&amp;quot; in a subroutine stack. The RETURN statement simply transfers program control to the address on the top of this stack. It also removes or &amp;quot;pops&amp;quot; the address from the top of the stack so that a subsequent RETURN statement will use the next address it finds on the top of the stack. &lt;br /&gt;
&lt;br /&gt;
Executing a RETURN statement with no return address in the subroutines stack causes a &amp;quot;GOSUB STACK UNDERFLOW&amp;quot; exception condition. &lt;br /&gt;
&lt;br /&gt;
Also see POP and POPALL. &lt;br /&gt;
 &lt;br /&gt;
 Example:  OPEN (1) &amp;quot;C1A&amp;quot; EXCP=9000&lt;br /&gt;
 READ (1,1000) EXCP=8000&lt;br /&gt;
 PRINT (0) &amp;quot;PROCESSING CUSTOMER:&amp;quot;;CUSTNO$&lt;br /&gt;
 GOSUB 1000&lt;br /&gt;
 PRINT (0) &amp;quot;COMPLETED CUSTOMER:&amp;quot;;CUSTNO$&lt;br /&gt;
 .&lt;br /&gt;
 STOP&lt;br /&gt;
 !&lt;br /&gt;
  Main routine  &lt;br /&gt;
 1000 CRAVAIL = CRLIMIT - ARTOTAL&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 RETURN&lt;br /&gt;
&lt;br /&gt;
 Subroutine  &lt;br /&gt;
&lt;br /&gt;
In this example, the main section of the program opens a data file called &amp;quot;C1A&amp;quot;, then reads a record from the file in sequential order. Next, the program displays a message on the video terminal (logical unit 0) and branches to a subroutine at statement-label 1000. &lt;br /&gt;
&lt;br /&gt;
Processing continues in the subroutine until the program encounters the RETURN statement. At this point, control is transferred back to the main section of the program (to the statement immediately after the GOSUB 1000 statement). &lt;br /&gt;
&lt;br /&gt;
The STOP statement is included in the main section of the program to prevent program flow from entering the subroutine without using the GOSUB statement&lt;/div&gt;</summary>
		<author><name>Badge</name></author>	</entry>

	</feed>