Skip to content
surfmuggle edited this page Sep 15, 2019 · 1 revision

Multiple results

func lastName(x, y string) (string, string) { return y, x }

Named return values

func split(sum int) (x, y int) { // named return values x,y 
	x = sum * 4 / 9
	y = sum - x
	return // naked: return statement without arguments returns the named return values
}

Variables

The keyword var declares a list of variables; the type is last.

 var c, python, java bool;      
 var i, j = 1, 2 
 var b, c = true, true 
Clone this wiki locally