From 89394d0fab076765b637b0fe643d8f8950639817 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 2 Feb 2025 20:13:05 +0000 Subject: Add int arithmetic example --- examples/41-generic-struct-methods/src/HelloWorld.shed | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 examples/41-generic-struct-methods/src/HelloWorld.shed (limited to 'examples/41-generic-struct-methods/src/HelloWorld.shed') diff --git a/examples/41-generic-struct-methods/src/HelloWorld.shed b/examples/41-generic-struct-methods/src/HelloWorld.shed new file mode 100644 index 00000000..a4e808e1 --- /dev/null +++ b/examples/41-generic-struct-methods/src/HelloWorld.shed @@ -0,0 +1,11 @@ +pub fun main() ! Io -> Unit { + val messageBox = Box("hello, world"); + + print!(messageBox.get()); +} + +struct Box[T](value: T) { + fun get(this) -> T { + this.value + } +} -- cgit v1.2.3