From 5d76fa1b86ff1bd15b9c6b546916bc03c9d9b9b4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 2 May 2026 09:33:20 +0100 Subject: Add example for sum types --- examples/02-sum/src/shapes.hob | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 examples/02-sum/src/shapes.hob (limited to 'examples/02-sum/src/shapes.hob') diff --git a/examples/02-sum/src/shapes.hob b/examples/02-sum/src/shapes.hob new file mode 100644 index 0000000..08336c5 --- /dev/null +++ b/examples/02-sum/src/shapes.hob @@ -0,0 +1,14 @@ +sum Shape { + variant Rectangle; + variant Triangle; +} + +struct Rectangle { + field width: Int32; + field height: Int32; +} + +struct Triangle { + field width: Int32; + field height: Int32; +} -- cgit v1.2.3