Newer
Older
01_hello / func / func.go
yhornisse on 27 Sep 2021 465 bytes add sample code
package main

import (
	"fmt"
	"localhost/hello/sub"
)

func hello() {
	fmt.Println("hello")
}

func hoge() (int64, int64, int64) {
	return 1, 2, 3
}

func println(str string) {
	fmt.Println(str)
}

func main() {
	hello()
	println("println")
	sub.Sample()

	v1, v2, v3 := hoge()
	fmt.Print(v1, v2, v3) // 1 2 3
	fmt.Println()
	_, v4, v5 := hoge()
	fmt.Print(v4, v5) // 1 2 3
	// _をPrintで指定するとビルドエラー cannot use _ as value
	fmt.Println()
}