1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/compiler/tests/repl/chained_fields.correct.repl

17 lines
426 B
Plaintext
Raw Normal View History

struct A { mut: v int } struct B { a A } struct C { mut: b B } struct D { mut: c C } struct E { mut: v []int } struct F { e []E }
mut b := B{} b = B{A{2}}
println('b is: ' + b.a.v.str())
mut c := C{} c.b = B{}
mut d := D{} d.c.b = B{}
f := F{[E{[10,20,30]},E{[100,200,300,400]}]}
println('f.e[0].v.len: ${f.e[0].v.len}')
println('f.e[1].v.len: ${f.e[1].v.len}')
===output===
b is: 2
f.e[0].v.len: 3
f.e[1].v.len: 4