I recognize you prefer smaller languages but I’d like to make a case for guards usefulness.
Guard is great because it’s a combined early return and assignment. Imho if you have a language with optionals, it’s a required pattern to have, or you end up with lots of conditional unwraps and nested blocks, or lots of placeholder variables that you might accidentally use in your code later causing safety or memory access issues .
Take the following code
if let foo = Some(optional) {yourLogicHere} else {return}
That’s one level of nesting.
Swift is nice enough to elide the Some matching so you’d just have
if let foo = optional {yourLogicHere} else {return}
Still one level of nesting but a little cleaner.
Now if you have a language based around safety, like Rust or Swift, a lot of functions return optionals. So you’ll keep nesting code in your checks for safety
Now take a guard.
guard let foo = optional else { return }
yourLogicHere
That’s one level of unnesting removed , and that compounds.
Better yet, you can chain them
guard let foo = optional, let spam = foo.lookup() else {return}
The equivalent in C like languages would be
type foo; if (!getOptional(&foo) return;
Now either you early return in the case of the optional failing or you nest. Nesting gets repetitive and deep.
Or you unnest like I have and have that foo sticking around un-initialized, potentially causing issues of use later.
Guard simultaneously removes both conundrums and makes your code both neater and safer.