From 46b17a7eb6d96c0e50d8b232b21d478f18b43c57 Mon Sep 17 00:00:00 2001 From: John Date: Sun, 21 Sep 2025 02:58:50 -0400 Subject: [PATCH] dummy: fn main syntax! yay --- dummy.do | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dummy.do b/dummy.do index 6c7f0c0..2392432 100644 --- a/dummy.do +++ b/dummy.do @@ -3,9 +3,8 @@ // This is a function. It can be called with the call operator. // The function called `main` is the program's entrypoint -// fn main() -> (&str, bool, i128) -const main = fn () { +fn main() /*-> (&str, bool, i128)*/ { // An if expression is like the ternary conditional operator in C let y = if 10 < 50 { "\u{1f988}" @@ -34,10 +33,10 @@ const main = fn () { // desugars to { - let _pass = || if idx > 2 * 2 { break idx }; - let _body = || { 12345 }; let _it = 0..100; - loop if let idx = _it.next() _pass() else _fail() + loop if let idx = _it.next() { + if idx > 2 * 2 { break idx } + } else break { 12345 } };