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: