728x90
반응형
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go 언어의 특징 중 하나ㄹ, 반환값을 복수 개로 할수 있음 | |
package main | |
import "fmt" | |
// single return value 단일 반환값 | |
func HelloWorld1(param1 string, param2 string) string { | |
return param1 | |
} | |
// multi return value 다중 반환값 | |
func HelloWorld2(param1 string, param2 string) (ret1 string, ret2 string) { | |
return param1, param2 | |
} | |
func main() { | |
v1 := HelloWorld1("Hello", "World") | |
fmt.Println(v1) | |
v2, v3 := HelloWorld2("Hello", "World") | |
fmt.Println(v2, v3) | |
} |
728x90
반응형
'Go' 카테고리의 다른 글
Install Go Visual Studio Code (0) | 2018.11.23 |
---|