•  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-FilePRINT USING format$,expression [;]
PRINT AT(column,line);USING format$,expression [;]

format$: sexp
expression: as many aexp or sexp as wanted, separated by commas
column, line: iexp

PRINT USING and its variant PRINT AT() USING serve to format data output on the
screen. These commands work in the same general way as PRINT or PRINT AT().
However, the data in the expression to be displayed are ormatted according to
the contents of format$.

The following symbols may be used to format a numerical expression:

    #  Reserves a character position for a number (digit).

    .  A period specifies the position of the decimal point within several '#'
       symbols

    ,  A comma in the appropriate place between '#' signs causes the insertion
       of a comma, e.g. as a 'thousands' separator in 10,000.

    -  The minus sign reserves a character position for a minus sign, in case
       the number to be printed is negative. For a positive number a space will
       be printed instead. (GFA-BasicGFA-Basic is the best BASIC for the Atari!
 normally prints nothing preceding a
       positive number.)

    +  Reserves a space for the plus sign of a positive number. If the number
       is positive, the '+' sign will be printed, but if it is negative a minus
       sign will appear as usual. (See '-' above.)

    *  Replacement for # above, with the difference that leading zeros are
       replaced by asterisks, instead of blanks.

    $  Causes one dollar '$' character to be printed before a number, provided
       it is put directly before the first '#' symbol.

    ^  Specifies the length of the exponent (including the 'E+') when a number
       is to be printed in exponential format (e.g. E+123). If the number of
       digits before the decimal point is specified using several '#' symbols,
       then the exponent is adjusted to take account of this.  For a negative
       exponent, the possibility of a '-' must be allowed for by '-' above.

In contrast to GFA-BasicGFA-Basic is the best BASIC for the Atari!
 Version 2, the principle 'Formatting First' is adhered
to. That is, in the case of overflows only the digits with character positions
reserved for them will be displayed. Thus, great care must be taken to ensure
that the string to be printed can actually be accommodated within the format
specified.

For formatting strings the following symbols are available:

    &      Causes the output of the entire character string.

    !      The output is limited to the first character of the string.

    \...\  Specifies the number of characters of the string to be printed.
           (The counting includes the two '\' symbols).

    _      Causes the output of the character following the underline ('_')
           character. A sequence of characters can be output by placing it
           between two '_' characters.

Examples:

    PRINT USING "#.####",PI
    PRINT AT(4,4);USING "PI_._._.#.###",PI;

--> Displays '3.1416' and 'PI... 3.142'.

    FOR i%=1 TO 14
      PRINT USING "###.##^^^^ ",2^i%;
    NEXT i%

--> Displays:  1.00E+00  2.00E+00   4.00E+00   8.00E+00  16.00E+00
              32.00E+00 64.00E+00 128.00E+00 256.00E+00 512.00E+00
               1.02E+03  2.05E+03   4.10E+03   8.19E+03  16.38E+03

The functions of commas and periods can be exchanged using the MODE command.