October 2019
Intermediate to advanced
434 pages
11h 54m
English
Let's jump in and look at a basic function written in Kotlin:
// Main.ktfun helloFunctions(greeting: String) { println("$greeting Kotlin Functions")}
This snippet demonstrates a fully functional, and quite simple, function written in Kotlin. There are several interesting things to note in this example:
A function is written by starting with the fun keyword. This tells the compiler that we are writing a new function. The next component is the function name. In the preceding example, the name is helloFunctions. Functions in Kotlin follow the same naming conventions as methods in Java. Next, we see that we are defining a greeting parameter of the ...
Read now
Unlock full access