GOLF(2gg)

NAME
print-out - (output)

PURPOSE
Print data out.

SYNTAX

        print-out <string> [ <length> ] [ url-encode | web-encode ] [ new-line ]

        print-out <number> new-line

        print-out source-file [ new-line ]

        print-out source-line [ new-line ]

DESCRIPTION
print-out outputs various kinds of data:

    • A <string> is output:

            print-out <string> [ <length> ] [ url-encode | web-encode ] [ new-line ]

        • By default, <string> is output without any encoding (meaning a string is output exactly as it appears). To output data verbatim to a client:

                set-string mydata="Hello world"
                print-out mydata

        Writing to client, outputting text followed by a horizontal rule - the text is output to a client (such as browser) as it is, and the browser will interpret tags "<br/>" and "<hr/>" as a line break and a horizonal line and display them as such:

                print-out "This is a non-encoded output<br/>" new-line
                print-out "<hr/>"

        Create a query text string by means of write-string statement:

                //
                // Construct the run-time text of dynamic SQL
                //
                write-string qry_txt
                   @select * from <<print-out table_name>>
                end-write-string

        • If "url-encode" clause is used, then the output is URL-encoded. This means such output is suited for use in URL parameters. Create a URL based on arbitrary strings used as URL parameters - for instance a space would be encoded as "%20" in the final output:

                @<a href='<<print-out "/update">>?item=<<print-out item_name url-encode>>'>Update</a>

    If "web-encode" clause is used, then the output is web-encoded (or HTML-encoded). This means such output is suited for use in web pages - the text will be displayed verbatim without HTML-markup being interpreted. Display "We use <hr/> markup" text, without "<hr/>" being displayed as a horizontal line:

            print-out "We use <hr/> markup" web-encode

If "length" clause is used, then only <length> leading bytes of <string> are output.

If "new-line" clause is used, then a new line ("\n") is output after <string>.

Note that all bytes of <string> are output, even if <string> contains null-bytes.

    • Outputs a number, given by <number>:

            print-out <number> [ new-line ]

    If "new-line" clause is used, then a new line ("\n") is output after <number>.

    To output a number to a client:

            set-number x = 100
            print-out x

    • Outputs the file name of the current source file.

            print-out source-file [ new-line ]

    This outputs the file name (relative to the source code directory) of the source file where the statement is located; this is often used for debugging.

    If "new-line" clause is used, then a new line ("\n") is output afterwards.

            @This file is <<print-out source-file>>

    • Outputs current line number in the source file.

            print-out source-line [ new-line ]

    This outputs the line number in the source file where the statement is located. It is often used for debugging purposes.

    If "new-line" clause is used, then a new line ("\n") is output afterwards.

            @This line is #<<print-out source-line>>

SEE ALSO
 Output

finish-output flush-output output-statement print-format print-out print-path See all documentation