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

26 lines
286 B
V

module main
[heap]
struct Node[T] {
mut:
value T
next ?&Node[T]
}
fn print_t1(node ?&Node[int]) {
println(node)
}
fn print_t2(mut node ?&Node[int]) {
n := node or { return }
println(n)
}
fn test_main() {
mut n := Node[int]{
value: 5
}
print_t1(n)
print_t2(mut n.next)
}