# Higher-Order Function

DevFeed: [Higher-Order Function](<https://devfeed.tech/articles/higher-order-function-25016.md>)

Original publisher: [Read original article](<https://typealias.com/concepts/higher-order-function/>)

Author: author@typealias.com (Dave Leeds)

Published: 2017-09-01T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [argument](<https://devfeed.tech/tags/argument.md>), [class](<https://devfeed.tech/tags/class.md>), [function](<https://devfeed.tech/tags/function.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [product](<https://devfeed.tech/tags/product.md>), [programming](<https://devfeed.tech/tags/programming.md>), [val](<https://devfeed.tech/tags/val.md>), [widget](<https://devfeed.tech/tags/widget.md>)

## AI overview

This article explains that a higher-order function accepts a function as an argument, returns a function as a result, or does both, with Kotlin examples including calculateCost() and getDiscount().

## Source excerpt

A higher-order function is a function does at least one of these: It accepts a function as an argument It returns a function as a result Kotlin supports higher-order functions. In the following example, calculateCost() accepts a function as an argument, and getDiscount() returns a function as a result. Example class Product(val name: String, val price: Double) val shippingCost = 4.0 val taxRate = 0.08 fun main(args: Array<String>) { val product = Product("Widget", 10.