MC-Basic:PRINTUSING
Language: | English • 中文(简体) |
---|
Prints formatted numeric variables, using the specified format string. The format string contains literal text to be printed, as well as characters for formatting numeric expressions. The following characters can be used formatting numeric expressions:
# digital position
. decimal position
+ prints the sign of the expression
^^^^ prints in exponential format
Only a single formatting string (containing text and formatting characters) followed by the expressions to print is allowed.
Short form
PrintU
Syntax
PrintUsing "<format_string>";[<expression>];{[<expression>]}*
Availability
All versions
Type
<format_string>: String
<expression>: Long, Double or String
Scope
Configuration, Task or Terminal
Limitations
Only 15 digits after the decimal point can be displayed. The statement,
printu "#.################";My_Var
Only prints 15 digits, and not 16 as specified by the format string. Only 16 digits before the decimal point are displayed. The statement:
printu "#.#";1e15
Is printed as
100000000000000.0
While
printu "#.#";1e16
Is printed as
1.0e16
print #1,"" emits \0 (zero character)
Examples
Specify a minimum number of characters to print by using the “#” sign and decimal point.
B = 33.344
PrintU "B is ##.##";B ‘prints B IS 33.34
PrintU "B is ##.####";B ‘prints B IS 33.3440
PrintU "B is ##.##^^^^";B ‘prints B IS 3.33e+01 (you must use exactly four ^s for this format to work)
Another example:
PrintU "The number is #";j1,j2
à The number is 1, The number is 2
Specifying the number of digits to print, prints data in tabular form since the number of places printed does not vary with the value of the number:
PrintU "Keep numbers to a fixed length with PrintUsing: ######" ; 100