Go Program to initialize more than one variable at a time


In this program, you will learn how to initialize more than one variable at a time in Go.


x, y := 10, 30

var x, y int = 10, 30

Example: How to initialize more than one variable at a time in Go

package main
import "fmt"

func main() {
	x, y := 10, 30
	fmt.Println("x value is :", x)
	fmt.Println("y value is :", y)
}

Output:

x value is : 10
y value is : 30