diff --git a/examples/tree_of_nodes.v b/examples/tree_of_nodes.v index 546ed23051..76d69a2f6d 100644 --- a/examples/tree_of_nodes.v +++ b/examples/tree_of_nodes.v @@ -1,6 +1,6 @@ -type Tree = Leaf | Node +type Tree = Empty | Node -struct Leaf {} +struct Empty {} struct Node { value int @@ -13,14 +13,14 @@ struct Node { // => it needs an explicit int(0) cast here: fn size(tree Tree) int { return match tree { - Leaf { int(0) } + Empty { int(0) } Node { 1 + size(tree.left) + size(tree.right) } } } fn main() { - node1 := Node{30, Leaf{}, Leaf{}} - node2 := Node{20, Leaf{}, Leaf{}} + node1 := Node{30, Empty{}, Empty{}} + node2 := Node{20, Empty{}, Empty{}} tree := Node{10, node1, node2} println('tree structure:\n $tree') println('tree size: ${size(tree)}')