Declaration

Grouped declarations

A parenthesized group combines specifications under one keyword without introducing a scope. Grouping is also available for const, type and import. Example output: '2 items'.

Formal Syntax & Structure

go syntaxgo
var ( name Type; other = expression )

Working Example

Example Snippetgo
package main
import "fmt"
func main() {  var (    count int = 2    label     = "items"  )  fmt.Println(count, label)}
Go Reference