I know that arror code is an anti-pattern that we should avoid. this link: https://blog.codinghorror.com/flattening-arrow-code/
Gives several ways to fix it. However, seems it won't apply for Scala. Especially when I want to return early at the beginning of the method if some condition is not met because "return" keyword is not encouraged in Scala.
Is there an elegant way to allow me do the following in Scala?
def someFunction(): Try[MyDataType] = {
if(some condition not met){
// exit function
}
// do my actual work
}