Explain the difference between function and method in scala?
Answer Posted / Sudhanshu Karnatak
In Scala, both functions and methods are first-class citizens. However, a method is a member of a class (either a trait or an object), while a function can be standalone. Methods have access to the instance's state, whereas functions don't have any state by default. Functions can be higher-order, meaning they can take other functions as arguments and return them as results.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers