The Unit return type declaration is optional for functions. The following codes are equivalent. Single-Expression functions:When a function returns a single expression, the curly braces can be omitted and the body is specified after = symbol fun sum(a : Int, b : Int) : Int = a + b Explicitly declaring the return type is […]
Month: ianuarie 2020
Kotlin Intro
Hello World Kotlin programs start at the main function. Here is an example of a simple Kotlin „Hello World” program: When compiled this code will be compiled into a file named after file name + ‘Kt’, if your file was named Main.kt, the compiled code will be in a file name MainKt. In the above […]