Created
March 26, 2015 22:46
-
-
Save regnerjr/460e48dfc9c526b20a2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Turns out in swift Bool is a struct! | |
/// From the Docs. `import Swift` | |
/// A value type whose instances are either `true` or `false`. | |
struct Bool { | |
/// Default-initialize Boolean value to `false`. | |
init() | |
} | |
// This means that if you try to switch on a Bool You must provide a default case. | |
switch tooSmallToSort { | |
case true: return a | |
case false: return a.reduce([a.first!], combine: _uniq) | |
} | |
// tooSmallToSort is a Bool, but we get a compiler error at the last brace urging us to add a default case. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment