# Chapter 6 questions

**URL:** <https://forums.kodeco.com/t/chapter-6-questions/45800>\
**Category:** Kotlin Apprentice\
**Created:** [August 10, 2018, 9:56pm UTC](https://forums.kodeco.com/t/chapter-6-questions/45800 "2018-08-10T21:56:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![abunur](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/abunur/32/109585_2.png) [@abunur](https://forums.kodeco.com/u/abunur)\
**Post date:** [August 10, 2018, 9:56pm UTC](https://forums.kodeco.com/t/chapter-6-questions/45800/1 "2018-08-10T21:56:27Z")

</div>

“You can assign this function to a variable using the method reference operator, ::, like so:

`var function = ::add`

Here, the name of the variable is function and its type is inferred as (Int, Int) → Int from the add function you assigned to it. The function variable is of a function type that takes two Int parameters and returns an Int.”

Excerpt From: By Joe Howard. “Kotlin Apprentice.” Apple Books.

`(Int, Int) -> Int` looks like **Swift** to me. Could we get an explanation of why `->` is used in Kotlin when passing a function as a parameter, but `:` is used for the return type of a function; whereas in Swift `->` is used throughout? Note we are previously introduced to `->` in the previous chapter with the `when` statement

---

<div class="post-metadata">

**Author:** ![dicklucas](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dicklucas/32/76755_2.png) [@dicklucas](https://forums.kodeco.com/u/dicklucas)\
**Post date:** [August 13, 2018, 6:12pm UTC](https://forums.kodeco.com/t/chapter-6-questions/45800/2 "2018-08-13T18:12:23Z")

</div>

Great question Abunur. I’m not exactly sure why the Kotlin creators chose that type of notation, but you can might be able to find / ask in the Kotlin language support forums.

Also, this [StackOverflow question](https://stackoverflow.com/questions/42646016/what-does-the-arrow-operator-do-in-kotlin) and the Kotlin docs on [higher order functions](https://kotlinlang.org/docs/reference/lambdas.html#function-types) might shed some light on the matter.
