Quantcast
Viewing latest article 10
Browse Latest Browse All 18

How to define a default value for a method parameter that is a function

I was just reminded that functions are values just like Int, String, etc. Beyond the “typical” use cases, this is also true when it comes to supplying a default value for a function parameter that you’re passing into a method.

As some quick background, as I showed in the Scala Cookbook, you can define a method that provides default values for one or more of its parameters like this:

read more


Viewing latest article 10
Browse Latest Browse All 18

Trending Articles