function in Kotlin

keys point of functions in Kotlin

  • The fun keyword is used to declare a function.
  • The parameter type is written after its name.
  • The function can be declared at the top level of a file; you don’t need to put it in a class.
  • Arrays are just classes. Unlike Java, Kotlin doesn’t have a special syntax for declaring array types
  • You write println instead of System.out.println. The Kotlin standard library provides many wrappers around standard Java library functions, with more concise syntax, and println is one of them.
  • You can omit the semicolon from the end of a line,

Kotlin function declaration

Kotlin function declaration
Kotlin function declaration

Leave a Comment