package main import ( "fmt2" ) type Point3D struct { x, y, z int } type Point3Df struct { x, y, z float32 } type acceptRange struct { lo uint8 hi uint8 } var t = [16]Point3D{{1,2,3},{y:4}} var acceptRanges = [16]acceptRange{ 0: {1, 2}, 1: {1, 2}, 2: {1, 0x9F}, 3: {0x90, 1}, 4: {1, 0x8F}, } func withInterface() { m := []interface{}{"a string", 1, 2.04, []int{1, 2, 3, 4}} get_string := m[0] fmt2.Println(get_string) get_num := m[1] fmt2.Println(get_num) get_float := m[2] fmt2.Println(get_float) get_array := m[3] fmt2.Println(get_array) } func main() { var p = Point3D{8,9,10} assert(p.x == 8) var p2 = Point3D{y:88} assert(p2.y == 88) var s = []Point3D{{1,2,3},{y:4}} fmt2.Println(s[0].x, s[0].y, s[0].z, s[1].x, s[1].y, s[1].z) assert(s[0].z == 3) assert(s[1].y == 4) var pf = Point3Df{1.1,20000000000000000000,3} assert(pf.x == 1.1) var t2 = []acceptRange{10:{1,1}, {2,2}, 1:{3,3}} fmt2.Println(t2) assert(t2[0].lo == 0) assert(t2[1].lo == 3) assert(t2[11].lo == 2) assert(len(t2) == 12) var t3 = []acceptRange{1:{1,1}, {2,2}, 10:{3,3}} fmt2.Println(t3) assert(t3[0].lo == 0) assert(t3[1].lo == 1) assert(t3[2].lo == 2) assert(len(t3) == 11) withInterface() }