FunctionalProgrammingSimplified icon indicating copy to clipboard operation
FunctionalProgrammingSimplified copied to clipboard

page 163: side effect and return type is Unit

Open peteanning opened this issue 5 years ago • 0 comments

val evenOrOdd = i match {
   case 1 | 3 | 5 | 7 | 9 => println("odd")
   case 2 | 4 | 6 | 8 | 10 => println("even")
}

I think this should just be:

val evenOrOdd = i match {
    case 1 | 3 | 5 | 7 | 9 => "odd"
    case 2 | 4 | 6 | 8 | 10 => "even"
}

If not the type of val evenOrOdd is Unit

peteanning avatar May 17 '19 08:05 peteanning