Conditional logic selects output or behavior when a condition is met. Use Go if statements for simple binary decisions; choose switch statements or maps for more complex cases. section 2.6 section 11.6
Go templates express conditional behavior with if, else if, and else actions enclosed by {{ and }}. The condition can use the current template value, called the dot, along with exposed fields. section 11.6 section 11.2
Choose template output
A template can branch on a condition: {{ if <cond> }}...{{ else if <cond> }}...{{ else }}...{{ end }}. This selects one output path while rendering the template. section 11.6




















