3 ms·
Can you help me understand why this would be beneficial, other than avoiding using the word "function"?
by lexicality 2y ago
Can you help me understand why this would be beneficial, other than avoiding using the word "function"?
- wruza 2y agoI guess you’re asking about the block part — it’s a minor syntactic convenience and not the main point of the comment. It avoids the word function/lambda or def-block and related syntactic inconvenience like parentheses around and at the end and interference with ASI (when applicable).
- kibwen 2y agoYou're looking for blocks-as-expressions, e.g. the following is valid Rust: let x = { whatever; 5 }; // assigns 5 to x