aboutsummaryrefslogtreecommitdiffhomepage
path: root/testdata/print.go
blob: 5156ad58e0ac5b1dc20b424129635db26d660058 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main

func main() {
	// test basic printing
	println("hello world!")
	println(42)
	println(100000000)

	// check that this one doesn't print an extra space between args
	print("a", "b", "c")
	println()
	// ..but this one does
	println("a", "b", "c")

	// print integers
	println(uint8(123))
	println(int8(123))
	println(int8(-123))
	println(uint16(12345))
	println(int16(12345))
	println(int16(-12345))
	println(uint32(12345678))
	println(int32(12345678))
	println(int32(-12345678))
	println(uint64(123456789012))
	println(int64(123456789012))
	println(int64(-123456789012))

	// print float64
	println(3.14)

	// print float32
	println(float32(3.14))

	// print complex128
	println(5 + 1.2345i)

	// print interface
	println(interface{}(nil))
	println(interface{}(true))
	println(interface{}("foobar"))
	println(interface{}(int64(-3)))
	println(interface{}(uint64(3)))
	println(interface{}(int(-3)))
	println(interface{}(uint(3)))

	// print map
	println(map[string]int{"three": 3, "five": 5})

	// TODO: print pointer

	// print bool
	println(true, false)

	// print slice
	println([]byte(nil))
	println([]int(nil))
}