GOLF(2gg)

NAME
inline-code - (language)

PURPOSE
Inline Golf code in an output statement.

SYNTAX

        <<golf code>>

DESCRIPTION
You can write Golf statements within an output-statement by using them between << and >> delimiters.

The following statements can be inlined: print-out,print-format, current-row, number-string, string-length, call-handler.

EXAMPLES
print-out statement displays a string, and in the following code it's used to display a result within an output-statement (i.e. within "@" statement):

        run-query ="select firstName, lastName from people" output firstName, lastName
           @<tr>
           @    <td>
           @        First name is <<print-out  firstName>>
           @    </td>
           @    <td>
           @        Last name is <<print-out lastName>>
           @    </td>
           @</tr>
        end-query

In the code below, "some_req" is a request handler that outputs some text, and it's used inline to output "Hello world":

        @Hello <<call-handler "/some-req">>

call-handler "some-req" would simply output "world":

        %% /some-req public
            @world
        %%

A write-string is typically used with output statements; in this case we print the value of another string, resulting in "There is 42 minutes left!":

        set-string mins="42"
        (( my_string
        @There is <<print-out mins>> minutes left!
        ))

SEE ALSO
 Language

inline-code statements syntax-highlighting unused-var variable-scope See all documentation