* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.PRINT USING Statement Details.

  QuickSCREEN      Details      Example      Contents      Index
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
PRINT USING Statement Details
 
Syntax
  PRINT USING formatstring; expressionlist [{,|;}]
 
The formatstring is a string literal (or variable) containing
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. Spaces, commas, and
semicolons in the expressionlist have the same meaning they do in a
PRINT statement.
 
The expressionlist contains the string expressions or numeric
expressions to be printed, separated by semicolons.
 
When PRINT USING is used to print strings, you may use one of three
formatting characters to format the string field, as described in the
following list:
 
  Character  Description
 
  !          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. 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.
  &          Indicates a variable-length string field. When the field
             is specified with the ampersand (&), the string is
             output without modification.
 
When PRINT USING is used to print numbers, the following special
characters can be used to format the numeric field:
 
  Character   Description
  #           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 may 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.
  +           Causes the sign of the number (plus or minus) to be
              printed before the number (if it appears at the
              beginning of the format string) or after (if it appears
              at the end of the format string).
  -           Causes a negative number to be printed with a trailing
              minus sign if it appears at the end of the format
              string.
  **          Causes leading spaces in the numeric field to be filled
              with asterisks. The double asterisk also specifies
              positions for two more digits.
  $$          Causes a dollar sign to be printed to the immediate
              left of the formatted number. The $$ 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 asterisk-filled
              and a dollar sign is printed before the number. The **$
              symbols specify 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 causes a comma to be printed to
              the left of every third digit left of the decimal point.
              If it appears at the end of the format string, it is
              printed as part of the string. A comma specifies another
              digit position. The comma has no effect if used with
              exponential (^^^^ or ^^^^^) format.
  ^^^^        Specifies exponential format. You can also use five
              carets (^^^^^) to allow E+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.
 
  Note: 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, an error message results that reads "Illegal
        function call."
* * ** * * * *