Last active
August 29, 2015 14:05
-
-
Save PeteC/b034ec34ce654c2e41b1 to your computer and use it in GitHub Desktop.
Revisions
-
PeteC revised this gist
Aug 27, 2014 . 1 changed file with 0 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,14 +14,6 @@ else { println("Different") } -
PeteC revised this gist
Aug 27, 2014 . 1 changed file with 8 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -31,24 +31,15 @@ enum AnotherEnum { } func ==(a:AnotherEnum, b:AnotherEnum) -> Bool { switch (a, b) { case (.StateA, .StateA): return true case let (.StateB(intA), .StateB(intB)): return intA == intB default: return false } } -
PeteC revised this gist
Aug 27, 2014 . 1 changed file with 24 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -30,21 +30,36 @@ enum AnotherEnum { case StateB(Int) } func ==(a:AnotherEnum, b:AnotherEnum) -> Bool { switch(a) { case .StateA: switch b { case .StateA: return true default: return false } case let .StateB(intA): switch b { case let .StateB(intB): return intA == intB default: return false } } } let anotherEnumValueA = AnotherEnum.StateA let anotherEnumValueB = AnotherEnum.StateB(1) if anotherEnumValueA == anotherEnumValueB { println("Same") } else { println("Different") } -
PeteC revised this gist
Aug 27, 2014 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,14 @@ else { println("Different") } switch enumValueA { case enumValueB: println("Same") default: println("Different") } -
PeteC revised this gist
Aug 27, 2014 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,14 +14,6 @@ else { println("Different") } @@ -40,3 +32,11 @@ else { println("Different") } switch anotherEnumValueA { case anotherEnumValueB: // Compiler error - doesn't conform to protocol IntervalType println("Same") default: println("Different") } -
PeteC revised this gist
Aug 27, 2014 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -14,6 +14,15 @@ else { println("Different") } switch anotherEnumValueA { case anotherEnumValueB: // Compiler error - doesn't conform to protocol IntervalType println("Same") default: println("Different") } enum AnotherEnum { -
PeteC revised this gist
Aug 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ enum AnotherEnum { } let anotherEnumValueA = AnotherEnum.StateA let anotherEnumValueB = AnotherEnum.StateB(1) if anotherEnumValueA == anotherEnumValueB { // Compiler error println("Same") -
PeteC created this gist
Aug 27, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ enum MyEnum { case StateA case StateB } let enumValueA = MyEnum.StateA let enumValueB = MyEnum.StateB if enumValueA == enumValueB { println("Same") } else { println("Different") } enum AnotherEnum { case StateA case StateB(Int) } let anotherEnumValueA = AnotherEnum.StateA let anotherEnumValueB = AnotherEnum.StateB if anotherEnumValueA == anotherEnumValueB { // Compiler error println("Same") } else { println("Different") }