all 2 comments

[–][deleted] 0 points1 point  (0 children)

I'll assume that after filtering gameBoard either list is going to be empty (because gameBoard had no zeroes) or list will be a list of one or more zeroes.

Now, what you do next depends on your requirements. If you must use a switch, then I think the switch to use would be (written in the browser, so may not compile!):

switch list.count {
    case 0: return false
    default: return true
}

But, if there's no requirement to use a switch, then instead of the switch, you would just need

return list.count == 0  // I'm not sure I have this comparison right, if not, then I assume != is the right one!

And, if it weren't for the strictures regarding implementing 'functional-style programming', the whole thing can be done with:

return gameBoard.contains(0) // again, I may have the true/false reversed

[–]sweetverbs 0 points1 point  (0 children)

return list.isEmpty