Article Outline
Go programming example 'golang-return'
golang-return
Golang beginners example: golang-return
package main
// import required modules
import (
"fmt"
)
func named() (str string) {
str = "lorem"
return
}
func typed() string {
var str = "ipsum"
return str
}
// main function
func main() {
fmt.Println(named())
fmt.Println(typed())
}
Useful links
- Learn Go: https://golangr.com
- Download Go: https://golang.org