63
63
otherwise, T1 is executed. Dot is unaffected.
65
65
{{range pipeline}} T1 {{end}}
66
The value of the pipeline must be an array, slice, or map. If
67
the value of the pipeline has length zero, nothing is output;
66
The value of the pipeline must be an array, slice, map, or channel.
67
If the value of the pipeline has length zero, nothing is output;
68
68
otherwise, dot is set to the successive elements of the array,
69
69
slice, or map and T1 is executed. If the value is a map and the
70
70
keys are of basic type with a defined order ("comparable"), the
71
71
elements will be visited in sorted key order.
73
73
{{range pipeline}} T1 {{else}} T0 {{end}}
74
The value of the pipeline must be an array, slice, or map. If
75
the value of the pipeline has length zero, dot is unaffected and
74
The value of the pipeline must be an array, slice, map, or channel.
75
If the value of the pipeline has length zero, dot is unaffected and
76
76
T0 is executed; otherwise, dot is set to the successive elements
77
77
of the array, slice, or map and T1 is executed.
100
100
- A boolean, string, character, integer, floating-point, imaginary
101
101
or complex constant in Go syntax. These behave like Go's untyped
102
102
constants, although raw strings may not span newlines.
103
- The keyword nil, representing an untyped Go nil.
103
104
- The character '.' (period):
105
106
The result is the value of dot.
147
148
The result is the value of invoking the function, fun(). The return
148
149
types and values behave as in methods. Functions and function
149
150
names are described below.
151
- A parenthesized instance of one the above, for grouping. The result
152
may be accessed by a field or map key invocation.
153
print (.F1 arg1) (.F2 arg2)
154
(.StructValuedMethod "arg").Field
151
156
Arguments may evaluate to any type; if they are pointers the implementation
152
157
automatically indirects to the base type when required.
198
203
successive elements of the iteration. Also, a "range" may declare two
199
204
variables, separated by a comma:
201
$index, $element := pipeline
206
range $index, $element := pipeline
203
208
in which case $index and $element are set to the successive values of the
204
209
array/slice index or map key and element, respectively. Note that if there is
227
232
{{"output" | printf "%q"}}
228
233
A function call whose final argument comes from the previous
235
{{printf "%q" (print "out" "put")}}
236
A parenthesized argument.
230
237
{{"put" | printf "%s%s" "out" | printf "%q"}}
231
238
A more elaborate call.
232
239
{{"output" | printf "%s" | printf "%q"}}