![]() IntelliJ IDEA nicely highlights the type specification for us, and by pressing only one key you can either remove it or leave it. The expression that the function returns goes after the ‘equals’ sign. IDE like IntelliJ Idea or Android Studio can automatically convert from one form to another. If your function simply returns one expression, you can use an alternative syntax, so-called, "function with expression body". In a similar manner, function return type specification follows the argument list. Note that the parameter type specification is put after the parameter name like for variables. This function returns a maximum of two values. Here you can see the syntax for function in Kotlin. Also, we'll touch the question of Java interoperability and discuss how to call a top-level function from Java. In this video, you will learn the different syntax of how to define a function in Kotlin. We'll discuss: basic syntax, nullability, functional programming with Kotlin, object-oriented programming with Kotlin, the power of the Kotlin standard library, and Java interoperability. ![]() Note that this course won't cover the programming fundamentals. The course is based on your Java experience it shows the similarities between the two languages and focuses on what's going to be different. We'll have a basic overview of the language, as well as a discussion of many corner cases, especially concerning Java interoperability. This course aims to share with you the power and the beauty of Kotlin. Kotlin code might be compiled not only to JVM bytecode but to JavaScript and Native code as well, but this course is focused on Kotlin/JVM. It’s a pragmatic language with a very low learning curve, and can be quickly grasped by Java developers. Kotlin is 100% compatible with all existing Java frameworks, and has good tooling support. It can be used almost everywhere Java is used today: for server-side development, Android apps, and much more. Kotlin is concise, safe, pragmatic, and focused on interoperability with Java code. The Kotlin programming language is a modern language that gives you more power for your everyday tasks.
0 Comments
Leave a Reply. |