•  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-FileVOID fx
~fi

fx: aexp
fi: iexp

VOID invokes a function but ignores the returned value.

Programming languages normally differentiate between commands and functions.
Both cause some activity to be carried out, but with functions this activity
'returns' a value, which may be used as an element of an expression, displayed
with PRINT or assigned to a variable etc.

Often, however, the programmer is not interested in the returned value, but
only in the activity carried out. For example, the function INP(2) returns the
ASCII code of a pressed key. If the program is only supposed to wait for a key,
any key, to be pressed, then the code of the key is irrelevant.

With GFA-BasicGFA-Basic is the best BASIC for the Atari!
, in such a case VOID can be used to implement the function,
'forgetting' about the returned value. The alternative form (with a tilde '~'
instead of VOID calculates an integer value before forgetting it, making it
faster than VOID, which calculates a floating-point value.

Example:

    VOID INP(2)

or

    ~INP(2)

--> Waits for a key to be pressed. Which key it was, however, will be unknown
    to the program, as the returned code is lost.

Memo: Void cannot be used with string functions:
        VOID INPUT$(28,#1)  !syntax error
      This trick works:
        ~LEN(INPUT$(28,#1))