Skip to content

Instantly share code, notes, and snippets.

View waterlink's full-sized avatar

Alex Fedorov waterlink

View GitHub Profile
fun main(args: Array<String>) {
print("What is your name? > ")
val name = readLine()
print("Hello, ")
print(name)
println("! How are things going?")
}
print("Hello, ")
print(name)
println("! How are things going?")
print("What is your name? > ")
val name = readLine()
fun main(args: Array<String>) {
print("Hello, ")
print(args[0])
println("! How are things going?")
}
fun main(args: Array<String>) {
… your program here …
}
fun main(args: Array<String>) {
println("Hello World")
}
class Try(private val block: () -> Unit,
private val catchHandler: ((Exception) -> Unit)?)
: () -> Unit {
constructor(block: () -> Unit): this(block, null) {}
fun whenThrown(catchHandler: (Exception) -> Unit): Try {
return Try(this, catchHandler)
}
fun main(args: Array<String>) {
println("Hello, Kotlin!")
}
class UserSearch {
func search_by_query(query : Query): [User] {
// .. we somehow use the database gateway here to search
}
}
// was: `user_search.search_by_nickname(user_nickname)`
user_search.search_by_query(UserNicknameQuery(user_nickname))