Golang ProgramsGolang Programs

Simple function without return value in Golang

package main

import "fmt"

func main() {
	add(20, 30)
}

func add(x int, y int) {
	total := 0
	total = x + y
	fmt.Println(total)
}
C:\golang\example>go run test1.go
50

C:\golang\example>