3 ms·
2nd version wouldn't compile (need to remove "match"). probably more idiomatic for the 1st version would be: userDao.getOptionalUser(username).map(u=>
by virtualwhys 11y ago
2nd version wouldn't compile (need to remove "match").
probably more idiomatic for the 1st version would be:
userDao.getOptionalUser(username).map(u=>
s"Hello, ${u.getFullName}"
).getOrElse("Not logged in")
i.e. string interpolate and map instead of match over Option.