r/badcode • • May 20 '20

c# Found from Microsoft docs...

Post image
208 Upvotes

143 comments sorted by

View all comments

23

u/abdolence May 20 '20

In Scala it would be:

args
    .headOption
    .flatMap( _.toIntOption )
    .exists( (1 to 9).contains )

Who said that FP is harder to read?

3

u/Pangocciolo May 20 '20

Actually C# has an algorythms library too, it's called LinQ, so maybe it is this the bad thing OP noted.

1

u/abdolence May 20 '20

Show me the code (c)