KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am watching Runar Bjarnason present Functional Programming for Beginners , and at 14:45 he defines a method: def isDivisibleBy(k: Int): Int => Boolean = i => i % k == 0 and a function: val isEven = isDivisibleBy(2) What are the pros and cons of defining isEven as a function rather than a method? I have read Scala Functions vs Methods as well as Difference between method and function in Scala , and I understand the semantic differences, but I wonder if there's some deeper reason in this case why a function might or might not be preferable to using a method: def isEven = isDivisibleBy(2)
Tags (comma-separated)
Save Edits
Cancel