How can I modify the following code snippet so that the “attempts” variable is known in the handleFailure function?
def getLoginAttempts(username: String): Option[Long] = ...
getLoginAttempts(username) filter (attempts => attempts <= MAX_ATTEMPTS) map {
handleFailure(username, attempts)
} orElse sendNotification()
compiler output => not found: value attempts
Why not simply:
Or maybe I don’t understand what is handleFailure?