Quantcast
Channel: How do I use multiple lines in Kotlins when switch? - Stack Overflow
Browsing all 3 articles
Browse latest 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 all 3 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>