Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Boolean values - bool, true, false

  • true
  • false
  • !
package main

import "fmt"

func main() {
	var flag bool = true
	fmt.Println(flag)        // true
	fmt.Printf("%T\n", flag) // bool

	flag = !flag
	fmt.Println(flag) // false

	other := false
	fmt.Printf("%v %T\n", other, other) // false bool
}