Please enable JavaScript to view this site.

A-Shell Reference

Updated December 2020; added ? syntax

PRINT {#ch} {TAB(...)} {USING mask}{delimiter} expr{delimiter expr delimiter...}

? {#ch} {TAB(...)} {USING mask}{delimiter} expr{delimiter expr delimiter...}

The two statements above are equivalent; a question mark ( ? ) may be used in place of "PRINT" in any ASB program.

PRINT outputs the specified material to file or screen.

ch is an integer expression specifying the file channel on which the file was opened. If not specified, or zero, output is to the terminal.

The optional TAB(...) clause may to position the output or modify the display attributes, in which case they may be combined with subsequent expressions indicating what to print. Note that for file output, only single-dimension TABs (column positioning) make sense; for row/col positioning and attributes in printed output, see GDI Printing. The TAB(...) clause may also be used to invoke client functions, in which case the subsequent expressions would either be omitted or used to supply parameters to the function rather than data to be printed. See Tab Functions for details.

USING mask may specify a format mask for the entire print operation, which must include format specifiers for each expression listed in the statement.

Each expression is a numerical or string expression, which may include a USING mask clause for formatting that one expression.

Each delimiter may be either a space, comma or semicolon. A space simply outputs a space. A semicolon outputs nothing beyond the preceding expression—i.e. stops the cursor just past the output of the expression. A comma adds several spaces following the preceding expression, unless a format mask was specified prior to the first expression, in which case commas are used simply to delineate the expressions so they can be matched up with the corresponding format specifiers in the mask. The last delimiter is optional. If omitted, a line terminator (CRLF or LF) is output.

Comments

The statement token "PRINT" may be replaced by the equivalent "?" for brevity.

PRINT statements are somewhat unusual in that they take a variable number of expressions as arguments. A PRINT statement with multiple arguments can be broken up into multiple PRINT statements with the same overall result. Alternatively, instead of using the delimiters to separate multiple expression arguments, you can use string concatenation to combine them all into a single string expression.

Three variations of PRINT are DPRINT, EPRINT and TPRINT (see Proportional Font Text Objects), all of which have the identical syntax but are only applicable for screen printing in a GUI environment. All three use the current default proportional font instead of the standard fixed-pitch text mode font. DPRINT adds a sunken panel effect and is typically used for displaying static data fields. EPRINT embeds the output fields in edit boxes, typically used for displaying editable data fields. For outputting to GUI screens you can also use AUI_CONTROL.

Examples

PRINT "Hello world"

? #7, CITY$;", ";STATE$;" ";ZIP$

? #7, CITY$ + ", " + STATE$ + " " + ZIP$ ! same result as preceding statement

? #CHREP USING "###. /---description ---/ $###,###.##", QTY, DESCR$, QTY*PRICE 

print tab(r,c);"Enter name: "'; tab(r,c+30);"Age: ";

Print (A using MASK1$) (B using MASK2$)

 

See Also

TRACE.PRINT: output to debug window
DEBUG.PRINT: output to debug window if DEBUG mode
WRITECD (following topic): comma delimited file output