Answers for "golang return function"

Go
0

golang return function

// Function with int as return type
func add(x int, y int) int {
	total := 0
	total = x + y
	return total
}

func main() {
	// Accepting return value in varaible
	sum := add(20, 30)
	fmt.Println(sum)
}
Posted by: Guest on June-12-2021

Browse Popular Code Answers by Language