From 28270d80af2fa090694359f84ec2b9cadee77995 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 24 Jun 2024 05:36:48 +0200 Subject: Support nested functions --- README | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'README') diff --git a/README b/README index 91b3fb6..473146c 100644 --- a/README +++ b/README @@ -61,3 +61,17 @@ Portuguese or ‘Όρυξ’ in Greek) as opposed to using the English name. x: int = 69; y: i64 = x; /* Compile-time error */ } + +7. Nested functions are supported, but not closures. Closures will + never be supported in the language. + + /* Recall that constants (including functions!) can be declared + in any order. This lets us define Inner *after* it gets + called by the assignment to ‘x’. */ + Outer :: () { + x := Inner(5); + + Inner :: (x: int) int { + return x; + } + } -- cgit v1.2.3