조건문1 조건문 if 조건문 보통 알고 있는 if문의 문법과 거의 동일하다. if 조건 { } 의 형식이다. if else 형식도 기존의 다른 언어 들과 동일하다. 다만 조건문의 Scope는 python과는 다르게 Brace로 구별한다. else if 문도 지원한다. c++, java, javascript라 다른 점은 조건을 쓸때 괄호로 감싸지 않는다. package main import ( "fmt" "math/rand" ) func main() { randNumber := rand.Intn(20) if randNumber > 10 { fmt.Println("this number over 10") } else if randNumber > 5 { fmt.Println("this number over 5") } else { f.. 2020. 12. 18. 이전 1 다음