"Go bool"의 두 판 사이의 차이

44번째 줄: 44번째 줄:


==같이 보기==
==같이 보기==
* [[Go if]]
* [[Go int]]
* [[Go int]]
* [[Go 자료형]]
* [[Go 자료형]]


[[분류: Go 자료형]]
[[분류: Go 자료형]]

2023년 5월 18일 (목) 01:04 판

1 개요

Go bool
  • true 또는 false 값을 가질 수 있는 Go 자료형
  • 제로값은 false이다.
package main

import "fmt"

func main() {
	a := true
	fmt.Println(a) // true
	a = false
	fmt.Println(a) // false
}
package main

import "fmt"

func main() {
	var a bool
	fmt.Println(a) // false
	a = true
	fmt.Println(a) // true
}
package main

import "fmt"

func main() {
	a := (99 == 99)
	fmt.Println(a) // true

	b := ("hello" == "world")
	fmt.Println(b) // false
}

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}