![]() The rest of this lesson shows the advantages that come from using this approach. That’s all there is to the basic technique. Just put your function’s input parameters in different groups, with each group surrounded by parentheses: def sum(a: Int)(b: Int)(c: Int) = a + b + cĪfter that, you can call sum like this: scala> sum(1)(2)(3) Instead of writing a “normal” add function with one parameter group like this: def add(a: Int, b: Int, c: Int) = a + b + c ![]() Writing functions with multiple parameter groups is straightforward.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |