Created
May 6, 2022 06:07
-
-
Save AndroidPoet/4e647136f7b2ddaf5b8d7da02404d992 to your computer and use it in GitHub Desktop.
Kotlin Functions
This file contains 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
fun main() { | |
printMessage("Hello") | |
printMessageWithPrefix("Hello", "World") | |
sum(4, 5) | |
multiply(4, 5) | |
} | |
fun printMessage(message: String) { | |
println(message) | |
} | |
fun printMessageWithPrefix(message: String, prefix: String = "This is String") { | |
println("$message $prefix") | |
} | |
fun sum(x: Int, y: Int) { | |
println("Sum") | |
println(x + y) | |
} | |
fun multiply(x: Int, y: Int) = println("Multiply" + x * y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment