If not true (!true)
Asked Answered
B

1

80

In golang's template/html package, I can use {{ if .loggedIn }} to check if logged in is true.

How do I check if .loggedIn is false without using ne or eq?


For example, I am looking for something like

{{ if !.loggedIn }}
<h1>Not logged in</h1>
{{ end }}
Bourassa answered 22/12, 2016 at 14:56 Comment(0)
I
123

Use the function not:

{{ if not .loggedIn }}
<h1>Not logged in</h1>
{{ end }}
Isomeric answered 22/12, 2016 at 15:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.