concept fun function in category kotlin

appears as: fun functions, fun function, The fun function, fun function
The Joy of Kotlin

This is an excerpt from Manning's book The Joy of Kotlin.

As you’ve seen, you can write safer programs that are easier to test by composing pure functions, which mean functions without side effects. You can declare these functions using the fun keyword or as value functions, such as the arguments of methods groupBy, map, or reduce in the previous listing. Value functions are functions represented in such a way that, unlike fun functions, they can be manipulated by the program. In most cases, you can use these as arguments to other functions or as values returned by other functions. You’ll learn how this is done in the following chapters.

Why should you use them? Because fun functions are much more efficient. They are an optimization. Each time you use a function only to pass it an argument and get the corresponding return value, you’ll be using the version defined with fun. This is absolutely not mandatory, but it’s wise.