Skip to content

Instantly share code, notes, and snippets.

@gonaumov
Created October 19, 2019 14:22
Show Gist options
  • Save gonaumov/bf5a87a441c2b15707798673b13998f2 to your computer and use it in GitHub Desktop.
Save gonaumov/bf5a87a441c2b15707798673b13998f2 to your computer and use it in GitHub Desktop.
Main.kt
/**
* 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