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 to 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.[1]

Contents

RETURN [link]

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 [link]

A computed GOSUB statement, ON...GOSUB, exists in some BASIC dialects. The syntax of the statement is ON x GOSUB line1, line2, ... 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 [link]

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.[2] In Visual Basic, GOSUB and ON..GOSUB were removed when VB.NET was released.

See also [link]

References [link]

  1. ^ "GOSUB...RETURN Statement Details.". Microsoft. 1988. https://www.qbasicnews.com/qboho/qckadvr.gosubr.shtml. Retrieved 2008-07-04. 
  2. ^ "GOSUB". 2008-05-08. https://www.freebasic.net/wiki/wikka.php?wakka=KeyPgGosub. Retrieved 2008-07-04. ""Gosub support is disabled by default in the -lang fblite unless the Option Gosub statement is used."" 

https://wn.com/GOSUB

CONFIG.SYS

CONFIG.SYS is the primary configuration file for the DOS and OS/2 operating systems. It is a special ASCII text file that contains user-accessible setup or configuration directives evaluated by the operating system during boot. CONFIG.SYS was introduced with DOS 2.0.

Usage

The directives in this file configure DOS for use with devices and applications in the system. The CONFIG.SYS directives also set up the memory managers in the system. After processing the CONFIG.SYS file, DOS proceeds to load and execute the command shell specified in the SHELL line of CONFIG.SYS, or COMMAND.COM if there is no such line. The command shell in turn is responsible for processing the AUTOEXEC.BAT file.

CONFIG.SYS is composed mostly of name=value directives which look like variable assignments. In fact, these will either define some tunable parameters often resulting in reservation of memory, or load files, mostly device drivers and TSRs, into memory.

In DOS, CONFIG.SYS is located in the root directory of the drive from which the system was booted.

Podcasts:

PLAYLIST TIME:
×