Created
October 19, 2019 14:22
-
-
Save gonaumov/bf5a87a441c2b15707798673b13998f2 to your computer and use it in GitHub Desktop.
Main.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* In this example, `val` denotes a declaration of a read-only local variable, | |
* that is assigned an pattern matching expression. | |
* See http://kotlinlang.org/docs/reference/control-flow.html#when-expression | |
*/ | |
fun main(args: Array<String>) { | |
val language = if (args.size == 0) "EN" else args[0] | |
println(when (language) { | |
"EN" -> "Hello!" | |
"FR" -> "Salut!" | |
"IT" -> "Ciao!" | |
"HUI" -> "Ahahahahaha. You are Bulgarian? Aren't you?" | |
else -> "Sorry, I can't greet you in $language yet" | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment