I want to print a list of strings after going through a pattern matching just to get into this powerful functionality.
How can I express the "do-nothing-but-return-unit" operation ?
What I mean is:
let print_nodes nodes =
match nodes with
[] -> (* here i want to noop *)
| s :: t -> print_string s; print_nodes t
You can simply write ()
.
See Variant values in the manual: ()
is how you build the unit
value.