Text and HTML templates / Built-in functions / Ess

Run Settings
LanguageGo
Language Version
Run Command
package main import ( "log" "os" "text/template" ) const tmplStr = `len(nil) : {{ len .SliceNil }} len(emptySlice): {{ len .SliceEmpty }} len(slice) : {{ len .Slice }} len(map) : {{ len .Map }} ` func main() { t := template.Must(template.New("len").Parse(tmplStr)) data := struct { SliceNil []int SliceEmpty []string Slice []bool Map map[int]bool }{ SliceNil: nil, SliceEmpty: []string{}, Slice: []bool{true, true, false}, Map: map[int]bool{5: true, 3: false}, } err := t.Execute(os.Stdout, data) if err != nil { log.Fatalf("t.Execute() failed with '%s'\n", err) } }
Editor Settings
Theme
Key bindings
Full width
Lines