Skip to content

Commit 7f4e14c

Browse files
author
Dean Wampler
committed
Slight logic error
1 parent cbbb927 commit 7f4e14c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/script/scala/progscala3/fp/datastructs/FlatMapValidate.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ val validPwd: Account => Option[Account] =
99
a => if a.password.length > 0 then Some(a) else None
1010

1111
val validAge: Account => Option[Account] =
12-
a => if a.age > 18 then Some(a) else None // <3>
12+
a => if a.age >= 18 then Some(a) else None // <3>
1313

1414
val accounts = Seq(
15-
Account("bucktrends", "1234", 18),
15+
Account("bucktrends", "1234", 17),
1616
Account("", "1234", 29),
1717
Account("bucktrends", "", 29),
1818
Account("bucktrends", "1234", 29))

0 commit comments

Comments
 (0)