Go: Output


Example: Hello World in Go


	package main
	
	import "fmt"
	
	func main() {
		fmt.Println("Hello, World!")
	}
	

Output:

  Hello, world!


fmt is a package that provides formatted I/O with functions similiar to C's printf and scanf.




Example: Output and Math in Go


	package main
	import "fmt"
	func main() {
		fmt.Println("Let's perform" + " math")
		fmt.Println("2+4 =", 2+4)
		fmt.Println("11.0/4.0 =", 11.0/4.0)
		fmt.Println(true && false)
		fmt.Println(true || false)
		fmt.Println(!true)
	}
	

Output:

  Let's perform math
  2+4 = 6
  11.0/4.0 = 2.75
  false
  true
  false