aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-10-29 20:35:45 +0000
committerMichael Williamson <mike@zwobble.org>2023-10-29 20:40:27 +0000
commite7e76ee0917f7f77966af69a7bca68ba37e4252e (patch)
tree6d65bb022af899dd9cdc68b1b95e384de427e4fc /examples
parent1353fdb3257c2a6c249b4bb11b0f13f382c22459 (diff)
Add example for inferring return type of function expressions
Diffstat (limited to 'examples')
-rw-r--r--examples/19-function-expression-infer-return-type/shed.toml7
-rw-r--r--examples/19-function-expression-infer-return-type/src/HelloWorld.shed4
2 files changed, 11 insertions, 0 deletions
diff --git a/examples/19-function-expression-infer-return-type/shed.toml b/examples/19-function-expression-infer-return-type/shed.toml
new file mode 100644
index 00000000..bf5c13c4
--- /dev/null
+++ b/examples/19-function-expression-infer-return-type/shed.toml
@@ -0,0 +1,7 @@
+[[shed.bins]]
+name = "hello-world"
+main-namespace = "HelloWorld"
+
+[[shed.examples]]
+bin = "hello-world"
+expected-output = "hello, world"
diff --git a/examples/19-function-expression-infer-return-type/src/HelloWorld.shed b/examples/19-function-expression-infer-return-type/src/HelloWorld.shed
new file mode 100644
index 00000000..1c93c946
--- /dev/null
+++ b/examples/19-function-expression-infer-return-type/src/HelloWorld.shed
@@ -0,0 +1,4 @@
+pub fun main() ! Io -> Unit {
+ val message = fn () { "hello, world\n" };
+ print!(message());
+}