case문1 Switch Switch Case문 기본적이니 스위치문과 동일 합니다. 다른 점은 대부분의 다른 언어에서 case문이 5개면 5개중에 맞는 게 어떤 것인지 break가 문을 만나지 않으며 계속 순차적으로 전부 순회하는데 반해, go lang에서는 하나라도 case가 매핑되면, 그대로 switch문을 나가버린다. 보통의 switch문과 다른게 없다. func switchFunc() { fmt.Println("this os is") switch os := runtime.GOOS; os { case "darwin": fmt.Println("OSX") case "linux": fmt.Println("linux") case "windows": fmt.Println("windows") default: fmt.Println(os.. 2020. 12. 23. 이전 1 다음