Swift if and switch can now be expressions
Swift if and switch can now be expressions
www.avanderlee.com If and switch expressions in Swift
By using if and switch statements as expressions, you can omit the return keyword and reduce the lines of code while maintaining readability.
This is one feature that I missed from some other languages like Kotlin. It isn’t super useful for ifs but a switch with a lot of cases? Bring it on.
0
comments