Go Lang (Go 언어)
6. (Go Lang) [Mac Os] Go 문법 : 논리 연산자 사용해 AND , OR 조건 확인 - true , false
투케이2K
2024. 2. 16. 16:25
728x90
[개발 환경 설정]
개발 언어 : Go

[소스 코드]
package main
import "fmt"
func main() {
// [명시적 선언]
var a bool = true
var b bool = false
// [논리 연산자 사용해 AND , OR 조건 확인]
var and bool = a && b // AND : 두 조건이 모두 참 인 경우 true
var or bool = a || b // OR : 두 조건 중 하나라도 참 인 경우 true
// [결과 출력]
fmt.Println("")
fmt.Println("----------------------------------------------")
fmt.Println("[로그 출력 수행]")
fmt.Println("----------------------------------------------")
fmt.Println("and : ", and)
fmt.Println("or : ", or)
fmt.Println("----------------------------------------------")
fmt.Println("")
}
[결과 출력]

728x90
반응형