Files
llgo/compiler/cl/_testrt/index/in.go

34 lines
471 B
Go
Raw Normal View History

2024-05-01 21:56:11 +08:00
package main
type point struct {
x int
y int
}
2024-06-16 22:18:02 +08:00
type N [2]int
type T *N
type S []int
2024-05-01 21:56:11 +08:00
func main() {
a := [...]point{{1, 2}, {3, 4}, {5, 6}}[2]
2024-06-16 22:18:02 +08:00
println(a.x, a.y)
2024-05-01 21:56:11 +08:00
b := [...][2]int{[2]int{1, 2}, [2]int{3, 4}}[1]
2024-06-16 22:18:02 +08:00
println(b[0], b[1])
2024-05-01 21:56:11 +08:00
var i int = 2
2024-06-16 22:18:02 +08:00
println([...]int{1, 2, 3, 4, 5}[i])
2024-05-01 21:56:11 +08:00
s := "123456"
2024-06-16 22:18:02 +08:00
println(string(s[i]))
println(string("123456"[1]))
var n = N{1, 2}
var t T = &n
println(t[1])
var s1 = S{1, 2, 3, 4}
println(s1[1])
println([2]int{}[0])
2024-05-01 21:56:11 +08:00
}