Continuing our Swift 3 Challenges today’s challenge has to do with order.
Given three ints, first, second, third, return true if
the second is greater than first, and third is greater than second.
However, with the exception that if the parameter “itsOk” is true,
second does not need to be greater than first but still better be less than third.
Try this before you look at my solution.
Seriously – try it yourself.
Okay – here is my solution.
And using the ternary operator we can get this down to one line of code.