GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

🌸 GOLF(2gg) 🌸

okay bestie, welcome to the Development section of the Golf manual πŸ’… this is the inline-code page and it's literally about sneaking Golf code into your output. no cap.


✨ NAME ✨

inline-code β€” (language)


πŸŽ€ PURPOSE πŸŽ€

Inline Golf code in an output statement. yes, inside it. we're being sneaky and it's iconic 🫢


πŸ¦‹ SYNTAX πŸ¦‹

<<golf code>>

🌈 DESCRIPTION 🌈

So here's the tea β˜• you can write Golf statements right inside an output-statement, you just gotta wrap them up between << and >> delimiters. that's it. that's the whole vibe πŸ’–

The following statements can be inlined, and yes these six are the only ones invited to the party:

  • print-out
  • print-format
  • current-row
  • number-string
  • string-length
  • call-handler

πŸ’… EXAMPLES πŸ’…

πŸ“ example one: print-out doing its thing

The 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 the "@" 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

🌸 example two: call-handler said hello

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
%%

🧚 example three: write-string + output = bestie behaviour

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

okay that's the whole page, you ate it, go inline something gorgeous πŸ’œβœ¨

sign-off time bestie πŸŽ€ this page is version $VERSION, dated $DATE, and it lives in the GOLF(2gg) manual. periodt. πŸ’…

πŸ“¦ where this page comes from