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

A common problem in Scala

KASATA

--

Working with a statically typed programming language like Scala can sometimes lead to a common compiler error message that might be tricky to understand if you’re new to the language or haven’t encountered it before. This is the `type mismatch; found : X required: Y` error which, as its name suggests, occurs when a value of type X is provided where a value of type Y is expected by the Scala language compiler.

Understanding the error

--

--

KASATA

Master of Applied Physics/Programmer/Optics/Condensed Matter Physics/Quantum Mechanics/AI/IoT/Python/C,C++/Swift/WEB/Cloud/VBA