| 1 | struct St { |
| 2 | mut: |
| 3 | x int |
| 4 | } |
| 5 | |
| 6 | fn main() { |
| 7 | shared abc := &St{ |
| 8 | x: 5 |
| 9 | } |
| 10 | abc.x++ |
| 11 | println(abc.x) |
| 12 | } |
| 13 | |
| 14 | struct Abc { |
| 15 | mut: |
| 16 | st shared St |
| 17 | } |
| 18 | |
| 19 | fn f() { |
| 20 | mut a := Abc{ |
| 21 | st: St{ |
| 22 | x: 9 |
| 23 | } |
| 24 | } |
| 25 | println(a.st.x) |
| 26 | } |
| 27 | |
| 28 | fn g() { |
| 29 | shared a := []f64{len: 10, init: 7.5} |
| 30 | println(a[3]) |
| 31 | } |
| 32 |