↧
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 ArticleAnswer 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 ArticleHow 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