github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/a48.gno (about) 1 package main 2 3 func main() { 4 { 5 b := []byte("ABCDEFGHIJKL") 6 a := b 7 println(&b[0] == &a[0], b[0], a[0]) 8 9 // modifying the underlying array modifies both a[0] and b[0], 10 // as it should 11 a[0] = 11 12 println(a[0], b[0]) 13 } 14 15 { 16 b := []byte{1, 2, 3} 17 a := b 18 println(&b[0] == &a[0], b[0], a[0]) 19 20 // modifying the underlying array modifies both a[0] and b[0], 21 // as it should 22 a[0] = 11 23 println(a[0], b[0]) 24 } 25 } 26 27 // Output: 28 // true 65 65 29 // 11 11 30 // true 1 1 31 // 11 11