I think this would be an excellent syntax addition. It’s also not something you can implement with macros without introducing type instability, see this discussion thread.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Feature request and Brainstorming , global let (issue #37187) | 20 | 1793 | October 7, 2020 | |
| Why does `let` allow comma-separated assignments? | 7 | 287 | May 3, 2024 | |
| REPL and for loops (scope behavior change) | 42 | 15299 | September 16, 2020 | |
| Tips on how to use let blocks to shadow local variables and avoid accidentally modifying the original variable | 9 | 513 | July 11, 2023 | |
| Let block in an inner function captures variables from outer function | 4 | 280 | March 13, 2023 |