Solving `type mismatch; found : X required: Y` Error in Scala
Briefly

The `found : X required: Y` part means that you're trying to use a value or variable of type X where type Y is expected. This could occur when assigning values to variables, returning values from a function, or passing arguments to a function or a method.
The easiest solution might be to ensure that the value or variable is of the expected type. For example, when 'add' expects two parameters of type Int, passing in two Strings will lead to a type mismatch error.
If it's not possible to change the type of the value or variable, casting it to the expected type can be an alternative fix. For instance, using the toInt function to convert Strings to Ints before calling a function.
Changing the function or method signature is another approach, ensuring it matches the type of the value or variable. For example, modifying 'add' to expect strings as parameters which it converts to Ints internally.
Read at Medium
[
add
]
[
|
|
]