File: output-statement.2gg

package info (click to toggle)
golf 601.4.41-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,824 kB
  • sloc: ansic: 20,020; sh: 1,171; makefile: 292
file content (103 lines) | stat: -rw-r--r-- 2,096 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
.TH GOLF 2gg $VERSION $DATE Development Tools
.SH NAME
output-statement \-  (output)
.SH PURPOSE
Output text.

.SH SYNTAX

.RS 4
.EX

@<text>

!<verbatim text>

.EE
.RE

.SH DESCRIPTION
Outputting free form text is done by starting the line with "@" or "!". The text is output unencoded with a new line appended.

With "@" statement, any \fBinline-code\fP executes and any output from those statements is output.

With "!" statement, all text is output verbatim, and any inline code is not executed. This is useful when the text printed out should not be checked for any \fBinline-code\fP.

All trailing whitespaces are trimmed from each source code line. If you need to write trailing whitespaces, with "@" statement you can use \fBprint-out\fP as \fBinline-code\fP. Maximum line length is 8KB - this is the source code line length, the actual run-time output length is unlimited.

Note that all characters are output as they are written, including the escape character (\e). If you wish to output characters requiring an escape character, such as new line and tab (as is done in C by using \en, \et etc.), use \fBprint-out\fP as \fBinline-code\fP.

.SH EXAMPLES
Outputting "Hello there": 

.RS 4
.EX

@Hello there

.EE
.RE

You can use other Golf statements inlined and mixed with the text you are outputting:

.RS 4
.EX

set-string weatherType="sunny"
@Today's weather is <<print-out weatherType>>

.EE
.RE

which would output 

.RS 4
.EX

Today's weather is sunny

.EE
.RE

With "!" statement, the text is also output, and this example produces the same "Hello there" output as "@":

.RS 4
.EX

!Hello there

.EE
.RE

In contrast to "@" statement, "!" statement outputs all texts verbatim  and does not execute any inline code:

.RS 4
.EX

set-string weatherType="sunny"
!Today's weather is <<print-out weatherType>>

.EE
.RE

which would output 

.RS 4
.EX

Today's weather is <<print-out weatherType>>

.EE
.RE

.SH SEE ALSO
 Output

\fBfinish-output\fP  
\fBflush-output\fP  
\fBoutput-statement\fP  
\fBprint-format\fP  
\fBprint-out\fP  
\fBprint-path\fP   
See all 
\fBdocumentation\fP