This command writes a string with a number of embedded numbers to the Output Window, or optionally writes the string and embedded numbers to the named file. The output string is not terminated with a newline unless the format string ends with a newline character. The newline character is '\n'. If present, keywords must be in the order
shown, i.e., If the If the The argument(s), number, is a variable or a constant. Only the first element of any number argument will be used. The argument formatString contains zero or more
The format
specification can use any of the format codes (f, e, g, b, or c)
that are valid for the Here is the list of special formatting characters you can use in the format string: Tab: \t Carriage Return: \r Newline: \n Quote: \"
The general format specification is: %width[.precision[code]] where: **%**introduces the format specification.[...] means "optional" (0 or one occurrences). **width**is a number that specifies the*minimum width*, in characters, that the number is allowed to have. The width includes the decimal point, any numbers before and after the decimal point, and the exponent, if any. For example, this number, 123.45, has width 6. This number, 1.234E02, has width 8. Note that the specified width is a minimum; therefore, if the number cannot be fit within the specified width, it will be allowed as much room as needed. If the width is greater than needed to fit the number, the number will be followed by spaces to fill the width.**precision**is a number that specifies the*maximum*number of significant digits or the*maximum*number of decimal places of this specification's output. For example, this number, 123.45, has a precision of 2. The number 1.234E02 has a precision of 4. That's because the precision for a number in scientific notation refers to the number of significant digits. The precision for a fixed point number refers to the number of digits after the decimal point.**code**is one of 'F', 'E', 'G', 'B', or 'C' either upper or lower case. If code is absent, it is assumed to be 'G'.F specifies fixed point output. The precision specifies the number of digits after the decimal point. E specifies Scientific Notation output. precision specifies the number of significant digits. G specifies "General" notation. This will be either fixed point or Scientific Notation depending on the number. B is same as G. C is the same as G.
The codes may be entered in either upper or
lower case. No distinction is made by |
The simplest OUTPUT command, with only a string argument, would be equivalent to the PRINT command except that the OUTPUT command does not automatically terminate with a newline. Therefore, multiple OUTPUT commands would print successively to the same line: OUTPUT "First output," OUTPUT " second output," OUTPUT " third output\n" 'This \n is a newline. The result is this: `First output, second output, third output` Here's an example embedding two constants into a single line: COPY 1,100 a STDEV a sd MEAN a avg The above program produces this one line output: Standard Deviation is 2.9E01 and the Mean is 5E01 The following program produces the same result using two output commands: COPY 1,100 a STDEV a sd MEAN a avg Result: Standard Deviation is 2.9E01 and the Mean is 5E01 The numbers are inserted into the format string, in order, replacing the format specifications. Here's an example showing the use of tabs to format the output: COPY 1,100 population SAMPLE 15 population sample1 SAMPLE 15 population sample2 SAMPLE 15 population sample3 MEAN population mean MEAN sample1 mean1 MEAN sample2 mean2 MEAN sample3 mean3 Result of one run: Population mean: 50.5 Sample 1 mean: 59 Sample 2 mean: 49.8 Sample 3 mean: 56.6 An example containing quotes: OUTPUT "He said, \"I can do it.\"" produces the following output: He said, "I can do it." |