Kotlin Switch Statement When equivalentKotlin when expressions are like Java switch statements, but you’ll see in this lesson, they’re much more powerful. If you’re experienced with Scala, when is similar to Scala’s match expression.
Replacement for switchIn its most basic use,
whencan be used as a replacement for a Java
when is an expression
whencan also be used as an expression, meaning that it returns a value:
In this page (written and validated by A. Gawali) you learned about Kotlin Switch Statement When equivalent . What's Next? If you are interested in completing Kotlin tutorial, your next topic will be learning about: Kotlin While Loop.
Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: firstname.lastname@example.org.