Standard library / html/template

html/template.New()

Creates a named, initially undefined template. Expected stdout: 'greet\n'.

Formal Syntax & Structure

go syntaxgo
func New(name string) *Template

Parameters & Attributes

NameTypeDescription
namestringName of the template.

Return Value

*Template

Creates a named, initially undefined template.

Working Example

Example Snippetgo
package main
import (  "fmt"  "html/template")
func main() { t := template.New("greet"); fmt.Println(t.Name()) }
Go Reference