Receiving “Code Blocks” as Input Parameters (Scala 3 Video)
In this Scala 3 video tutorial, I show how to write functions that receive “code blocks” as input parameters, and how these code blocks compare to receiving functions as input parameters.
To do this I show the difference between Call By Name and Call By Value input parameters, and I show situations where using function input parameters doesn’t work as well as receiving a block of code as an input parameter. I also mention how other names like Call On Access might be better names than Call By Name (or at least more modern names).
Examples include creating a timer
function and a whilst
function (which also uses recursion).
Update: All of my new videos are now on
LearnScala.dev