Caché Basic Reference
Print, Println
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Writes a string to the current device.
Synopsis
Print expr
Println expr
Arguments
expr An expression that is evaluated and written to the current device. This can be a single expression, or a comma-separated list of expressions.
Description
The Print statement is used to write an expression (or a list of expressions) to the current device. The Println statement is identical to Print, except that it automatically appends vbCRLF (carriage return / line feed) after writing the last expression in the list.
Examples
The following example demonstrate the use of the Print and Println commands with strings and string variables. To include a quote character within a string, double the quote character. Printing the empty string ("") completes without error and can be used with Println to insert a blank line. An undefined variable (z in this example) is treated the same as the empty string. Note that variable names are case-sensitive.
Set a="big "
Set b="bad "
Set c="bug"
Print "Hello"
Println " world!"
Println ""
Println "this is a quote ("") character"
Println z
Println a,b
Println c
Print a,b
Print c
 
The following example demonstrate the use of the Print and Println commands with numeric expressions. Caché converts numbers to canonical form, removing unnecessary signs and leading and trailing blanks. It then evaluates arithmetic expressions. Numbers specified as string are passed as literals without conversion.
Set x="++007.9900"
Set y=++007.9900
Println 123456
Println (3+3)*2
Println 3+(3*2)
Println +007.9900
Println x
Println y
 
The following example demonstrate the use of the Print and Println commands with subscripted global variables:
Set ^a(1)="fruit"
Set ^a(1,1)="apple"
Println "An ",^a(1,1)," is a ",^a(1)
 
See Also