Skip to content

Higher order functions

Devrath edited this page Feb 10, 2024 · 15 revisions

Definition

  • Higher-order functions are the ones that take functions as parameters or return function as a result.
  • We can even store the higher-order function in a variable and a data structure.
  • They enable functional programming concepts and allow you to write more concise and expressive code.

Declaring Functions

  • Functions in kotlin have a type
  • The same way as we can declare Int,String,Person we can declare something of type function
  • A type is composed of FunctionParameters + FunctionReturnType (Parameters are declared within these brackets) --> ReturnType

Contents

Clone this wiki locally