and
假值包括 false
、0
、任何 nil
指標或介面值、長度為零的陣列、切片、映射或字串,以及零 time.Time
值。
其他一切皆為真值。
{{ and 1 0 "" }} → 0 (int)
{{ and 1 false 0 }} → false (bool)
{{ and 1 2 3 }} → 3 (int)
{{ and "a" "b" "c" }} → c (string)
{{ and "a" 1 true }} → true (bool)
查看 Go 的 text/template 文件以獲得更多資訊。