bas7advr.hlp (Topic list)
PRINT USING Statement Details
  Syntax  Details  Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Prints strings or numbers using a specified format.
 
PRINT USING formatstring$; expressionlist [;]
    ■ Semicolons, spaces, or tabs can be used in expressionlist
      to separate items. In contrast with the PRINT statement, delimiters
      in expressionlist used with PRINT USING have no effect on item
      placement.
    ■ The argument formatstring$ is a string literal (or variable) that
      contains literal characters to print (such as labels) and special
      formatting characters. These formatting characters determine the
      field and the format of the printed strings or numbers.
 
Important
    ■ If the number to be printed is larger than the specified numeric
      field, a percent sign (%) is printed in front of the number. If
      rounding causes the number to exceed the field, a percent sign is
      printed in front of the rounded number. If the number of digits
      specified exceeds 24, BASIC generates the error message, "Illegal
      function call."
 
    ■ String Variable Formatting Characters
 
        Character   Rules
        ═════════   ═══════════════════════════════════════════════════════
        !           Only the first character in the given string is to
                    be printed.
        \ \         Prints 2 + n characters from the string, where n is
                    the number of spaces between the two backslashes.
                    For example, if the backslashes are typed with no
                    spaces, two characters are printed; with one space,
                    three characters are printed, and so on.
                    If the field is longer than the string, the string
                    is left-justified in the field and padded with
                    spaces on the right.
        &           The string is output without modification.
 
    ■ Numeric Variable Formatting Characters
 
        Character   Rules
        ═════════   ═══════════════════════════════════════════════════════
        #           Represents each digit position. Digit positions are
                    always filled. If the number to be printed has fewer
                    digits than positions specified, the number is
                    right-justified (preceded by spaces) in the field.
        .           Prints a decimal point. A decimal point can be inserted
                    at any position in the field. If the format string
                    specifies that a digit is to precede the decimal point,
                    the digit is always printed (as 0, if necessary).
                    Numbers are rounded as necessary.
        +           Prints the sign of the number (+ or -) before the
                    number (if it appears at the beginning of the format
                    string) or after (if it appears at the end).
        -           Prints a negative number with a trailing minus sign if
                    it appears at the end of the format string.
        **          Fills leading spaces in the numeric field with
                    asterisks. Also specifies positions for two more digits.
        $$          Prints a dollar sign to the immediate left of the
                    formatted number. Specifies two more digit positions,
                    one of which is the dollar sign.
        **$         Combines the effects of the double-asterisk and
                    double-dollar-sign symbols. Leading spaces are filled
                    with asterisks and a dollar sign is printed before
                    the number. Specifies three more digit positions, one
                    of which is the dollar sign. When negative numbers
                    are printed, the minus sign appears to the immediate
                    left of the dollar sign.
        ,           If the comma appears to the left of the decimal point
                    in a format string, it makes a comma print to the left
                    of every third digit left of the decimal point. If the
                    comma appears at the end of the format string, it is
                    printed as part of the string. Specifies another digit
                    position. Has no effect if used with exponential
                    (^^^^ or ^^^^^) format.
        ^^^^        Specifies exponential format. Five carets (^^^^^)
                    allows D+xxx to be printed for larger numbers. Any
                    decimal point position may be specified. The significant
                    digits are left-justified and the exponent is adjusted.
                    Unless a leading +, trailing +, or - is specified,
                    one digit position is used to the left of the decimal
                    point to print a space or a minus sign.
          _         An underscore in the format string prints the next
                    character as a literal character. A literal underscore
                    is printed as the result of two underscores ( __ ) in
                    the format string.