To be honest, the only use case for this idiom I (or my colleagues) ever came across is the one you mentioned in the post. Expressions with side effects are generally discouraged, so I think we do well enough in this case.
Related Topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
Why I can't apply value inside while loop? | 13 | 20100 | October 25, 2019 | |
Assignments are not expressions and only expressions are allowed in this context | 1 | 7270 | January 15, 2018 | |
Assignments as expressions | 1 | 4419 | March 29, 2016 | |
(Assignment expressions) Kotlin Syntax | 2 | 1046 | November 25, 2020 | |
Different null check behavior in assignment vs expression | 3 | 675 | June 3, 2021 |