An idea about returning values from block expressions #1500
Replies: 2 comments
-
Looks like there was a discussion on this here: #430 |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, I disagree. |
Beta Was this translation helpful? Give feedback.
-
Returning values from block expressions is a useful feature in rust which makes the code cleaner.
It might be a good idea to introduce a similar syntax.
For example:
Can be simplified as:
Or we can use a keyword
eval
to make the syntax more elegant:The function of
break
here is to return the following variable (or expression) as the value of the block expressionBeta Was this translation helpful? Give feedback.
All reactions