Android
Getting Started with Kotlin – Tutorial 4 – Functions
Compared to JAVA, Kotlin has a different syntax when writing functions. Lets take a look at an example and then break down every line to understand it.
1 2 3 4 5 6 |
//Function Example fun simpleFunction(message: String): Int { println(message) return 10 } |
In kotlin, to define a function you have to use the fun keyword. After the keyword comes the function name and then the Read more…