Difference between revisions of "OUTS"
(Created page with "'''OUTS''' is a CAOS command for outputting strings (OUTput String). ==Usage== Syntax: ''OUTS var_or_string_literal(string)'' This sends the contents of ''var_or_string_...") |
m |
||
Line 34: | Line 34: | ||
</pre> | </pre> | ||
− | Using [[FILE OOPE]], append to the journal file "MyFile", write the number of world [[Tick|Ticks]] (after converting [[WTIK]] to a string | + | Using [[FILE OOPE]], append to the journal file "MyFile", write the number of world [[Tick|Ticks]] (after converting [[WTIK]] to a string using [[VTOS]]), then close the journal file: |
<pre> | <pre> | ||
FILE OOPE 0 "MyFile" 1 | FILE OOPE 0 "MyFile" 1 |
Latest revision as of 12:34, 16 July 2013
OUTS is a CAOS command for outputting strings (OUTput String).
Usage[edit]
Syntax: OUTS var_or_string_literal(string)
This sends the contents of var_or_string_literal to the output stream as a string. It is most commonly used from the CAOS Command Line, where the default output stream is the console; but it can also be used with FILE OOPE. See output stream for more specifics on where the string will be sent.
If you just want to output a string to the debug log, use DBG: OUTS instead.
Escape Sequences[edit]
Escape sequences allow strings to display characters that would otherwise be disallowed. Escape sequences begin with a backslash.
\n New line. Text that follows will be on a new line. \" Double quote. Allows a double quote to be used in a string literal. \\ Backslash. Allows a backslash to be used in a string literal.
It is likely that there are other escape sequences that are not listed here.
Attempting to escape a character that does not require it may cause unexpected results. For example, \a will cause a syntax error, and may have other undocumented significance to CAOS.
Examples[edit]
Using OUTS and a string literal, print "Hello World!" using the CAOS Command Line:
OUTS "\"Hello World!\""
Using OUTS and the HAND function, print the name of the Hand using the CAOS Command Line:
OUTS HAND
Using FILE OOPE, append to the journal file "MyFile", write the number of world Ticks (after converting WTIK to a string using VTOS), then close the journal file:
FILE OOPE 0 "MyFile" 1 OUTS VTOS WTIK OUTS " ticks have passed.\n" FILE OCLO