sorry for the newbie question.
how can I make the test2 turns out to be 1?
{{$test := 0}}
{{ if gt 1 0 }}
{{$test := add $test 1}}
<div>test1 = {{ $test }}</div> --> 1
{{end}}
<div>test2 = {{ $test }}</div> --> 0
sorry for the newbie question.
how can I make the test2 turns out to be 1?
{{$test := 0}}
{{ if gt 1 0 }}
{{$test := add $test 1}}
<div>test1 = {{ $test }}</div> --> 1
{{end}}
<div>test2 = {{ $test }}</div> --> 0
Use:
{{$test = add $test 1}}`
:= assigns to a new variable.
but I got this error on version 0.45
unexpected "=" in operand
:= to initialize the variable, then use = to re-assign to a new value.thanks very much.
after upgrading to the latest version, it works. 
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.