github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/testdata/go1.21.go (about) 1 package main 2 3 func main() { 4 // The new min/max builtins. 5 ia := 1 6 ib := 5 7 ic := -3 8 fa := 1.0 9 fb := 5.0 10 fc := -3.0 11 println("min/max:", min(ia, ib, ic), max(ia, ib, ic)) 12 println("min/max:", min(fa, fb, fc), max(fa, fb, fc)) 13 14 // The clear builtin, for slices. 15 s := []int{1, 2, 3, 4, 5} 16 clear(s[:3]) 17 println("cleared s[:3]:", s[0], s[1], s[2], s[3], s[4]) 18 19 // The clear builtin, for maps. 20 m := map[int]string{ 21 1: "one", 22 2: "two", 23 3: "three", 24 } 25 clear(m) 26 println("cleared map:", m[1], m[2], m[3], len(m)) 27 m[4] = "four" 28 println("added to cleared map:", m[1], m[2], m[3], m[4], len(m)) 29 }