<if else return in kotlin> <https://i.stack.imgur....
# stackoverflow
u
if else return in kotlin

https://i.stack.imgur.com/IhZcC.png

Error : Kotlin: Type mismatch: inferred type is String but Unit was expected code : fun main() { val a = 2 var data: String = if (a != 2) { return "Hello" } else { return "World" } }