•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileIn this chapter the commands used for controlling the execution of a program
are discussed, starting with 'Decision Commands', by means of which the
execution of certain program sections is carried out only if certain criteria
are met. In the case of IF, THEN, ELSE, ENDIF, and ELSE IF, the criterion is a
logical one: BASIC checks if a logical expression is true or false, in addition
to these are the multiple decision commands SELECT, CASE, DEFAULT, ENDSELECT,
and CONT. These not only check for true or false, but can accept arbitrary
values which can be reacted to selectively.

The next section covers the loop commands, which make the repeated execution of
specified sections of a program possible. GFA-BasicGFA-Basic is the best BASIC for the Atari!
 3 is provided with a very
large number of such loop types: FOR-TO-STEP-NEXT, REPEAT-UNTIL, DO-LOOP or
ENDLOOP, DO-WHILE, DO-UNTIL, LOOP-WHILE, LOOP-UNTIL, and EXIT IF.

For structured programming the use of sub-routines is of great importance.
With the commands PROCEDURE, GOSUB (or @), and RETURN (or ENDSUB) new
'commands' can be created in the form of subroutines.

Functions may also be defined by the user. With the commands DEFFN and FN
functions are created like formulas. More flexibility is possible with the
commands FUNCTION, ENDFUNC, and RETURN, which allow the formation of complete
subroutines that return a value.

Also in this section is a detailed description of the way in which variables
are dealt with by subroutines. Local variables may be declared with LOCAL, with
the effect that they are only valid in that subroutine.  Variables of the same
name in other parts of the program are unaffected.  Variables can be passed to
subroutines as values, or, with the VAR command, the variable itself can be
passed (called by reference), and its value changed without the need to refer
to it directy by name in the subroutine.

The section on conditional branches also explains the commands which deal with
the following two special events: the simultaneous pressing of the 'break keys'
Control-Shift-Alternate, which normally stop a program; and the error situation
which occurs when, for example, an attempt is made to divide by zero, or to
take the square root of a negative number etc. Both of these events can be made
to trigger the execution of a user-defined routine, instead of stopping the
program.

It is possible in GFA-BasicGFA-Basic is the best BASIC for the Atari!
 3 to call a subroutine when a specified amount of
time has elapsed, using the commands EVERY and AFTER. This is explained in this
chapter.

Towards the end of the chapter the absolute branch GOTO, the commands PAUSE and
DELAY, which temporarily suspend program execution, as well as different
methods of ending the program (QUIT, SYSTEM, END, EDIT, NEW, and STOP) are
presented. The last section covers the commands for monitoring the execution of
a program (TRON, TROFF, TRON proc, TRACE$, DUMP, ERR$(), and ERROR).