Quantcast
Channel: How do I use multiple lines in Kotlins when switch? - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by Dehodson for How do I use multiple lines in Kotlins when switch?

You need to surround your multiple lines of code in a block, like so:when(version) {"anhorig" -> { Log.d("TAG", "Anhorig") subHeader.text = getString(R.string.sv_anhorig_ch1) }"personal" ->...

View Article


Answer by Demigod for How do I use multiple lines in Kotlins when switch?

When a case of a when statement is more than one line, you should use the block of code in braces {}. Like this:when(version) {"anhorig" -> { Log.d("TAG", "Anhorig") subHeader.text =...

View Article

How do I use multiple lines in Kotlins when switch?

Kotlin uses when instead of switch and it looks something like this:when(version) {"v1" -> Log.d("TAG", "WOW")"v2" -> Log.d("TAG", WOAAH") else ->"Log.d("TAG", "ELSE")So far so good. But what...

View Article
Browsing latest articles
Browse All 3 View Live