How to write Functions in Kotlin? Kotlin Function Tutorial

Опубликовано: 31 Октябрь 2024
на канале: Ludwig Dickmanns
1,291
28

Functions in Kotlin!

In this video, you're going to learn about function basics in Kotlin. You can define functions with the 'fun' keyword. The function signature looks very similar to UML or Python (if you use type annotations). Also, for single expression functions, you can use an expression body. This means that you can just assign the expression to the function with an equal sign. Finally, the Kotlin compiler helps you to write even more concise code with type inference. So if the compiler can infer the return type of a function, you can the return type entirely.

Documentation for the Function Basics in Kotlin:
https://kotlinlang.org/docs/basic-syn...
Coding Conventions for Kotlin Functions:
https://kotlinlang.org/docs/coding-co...

IntelliJ IDEA Community Version:
https://www.jetbrains.com/idea/

@kotlin.learnings on Instagram:
  / kotlin.learnings  
@java.learnings on Instagram:
  / java.learnings  

Thank you for watching!