Revision as of 12:49, 19 October 2011 editClueBot NG (talk | contribs)Bots, Pending changes reviewers, Rollbackers6,439,047 editsm Reverting possible vandalism by 67.149.219.128 to version by FrescoBot. False positive? Report it. Thanks, ClueBot NG. (663933) (Bot)← Previous edit | Revision as of 12:50, 19 October 2011 edit undo67.149.219.128 (talk) →Computed GOSUBTag: repeating charactersNext edit → | ||
Line 8: | Line 8: | ||
Using GOSUB too many times, as in a loop or recursively, without corresponding RETURN statements, would typically cause a ]. On the other hand, when the BASIC interpreter encounters a RETURN statement without a GOSUB it will emit a <code>RETURN WITHOUT GOSUB</code> error. | Using GOSUB too many times, as in a loop or recursively, without corresponding RETURN statements, would typically cause a ]. On the other hand, when the BASIC interpreter encounters a RETURN statement without a GOSUB it will emit a <code>RETURN WITHOUT GOSUB</code> error. | ||
== Computed GOSUB == | ''''''== Computed GOSUB == | ||
now you know that you do not wont to really do this lol so bye bye i hope u have fun tryin to figure this out cuzz all this information is wrong!!!!!!!!!!!!!!!!!!!!!!!!! | |||
A computed GOSUB statement, <code>ON...GOSUB</code>, exists in some BASIC dialects. The syntax of the statement is <code>ON x GOSUB line1, line2, ...</code> Computed GOSUB branches to one of several destinations based on the value of x. RETURN commands return program flow to the statement following ON..GOSUB. | |||
== Support == | == Support == |
Revision as of 12:50, 19 October 2011
GOSUB is a command in many versions of the BASIC computer programming language. A GOSUB statement jumps to a line elsewhere in the program. That line and the following lines up a RETURN are used as a simple kind of a subroutine without (sometimes with) parameters or local variables.
The GOSUB command may be used to emulate subroutines in a BASIC dialect that does not support subroutines in its syntax. GOSUB is convenient for performing the same function several times in a BASIC program without duplicating the code.
RETURN
A RETURN command resumes program flow from the point at which GOSUB was invoked.
Using GOSUB too many times, as in a loop or recursively, without corresponding RETURN statements, would typically cause a stack overflow. On the other hand, when the BASIC interpreter encounters a RETURN statement without a GOSUB it will emit a RETURN WITHOUT GOSUB
error.
'== Computed GOSUB == now you know that you do not wont to really do this lol so bye bye i hope u have fun tryin to figure this out cuzz all this information is wrong!!!!!!!!!!!!!!!!!!!!!!!!!
Support
Not all BASIC implementations support GOSUB or ON..GOSUB. For example, in FreeBASIC GOSUB is considered as deprecated in favor of SUB/FUNCTION, and is disabled by default. In Visual Basic, GOSUB and ON..GOSUB were removed when VB.NET was released.
See also
References
- "GOSUB...RETURN Statement Details". Microsoft. 1988. Retrieved 2008-07-04.
- "GOSUB". 2008-05-08. Retrieved 2008-07-04.
Gosub support is disabled by default in the -lang fblite unless the Option Gosub statement is used.
This programming-language-related article is a stub. You can help Misplaced Pages by expanding it. |