Skip to content

Instantly share code, notes, and snippets.

@danielctull
Forked from PeteC/gist:b034ec34ce654c2e41b1
Created August 27, 2014 09:52
Show Gist options
  • Select an option

  • Save danielctull/f20fe5e1aaeaf6c08cd6 to your computer and use it in GitHub Desktop.

Select an option

Save danielctull/f20fe5e1aaeaf6c08cd6 to your computer and use it in GitHub Desktop.

Revisions

  1. @PeteC PeteC revised this gist Aug 27, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.swift
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ enum AnotherEnum {
    }

    let anotherEnumValueA = AnotherEnum.StateA
    let anotherEnumValueB = AnotherEnum.StateB
    let anotherEnumValueB = AnotherEnum.StateB(1)

    if anotherEnumValueA == anotherEnumValueB { // Compiler error
    println("Same")
  2. @PeteC PeteC created this gist Aug 27, 2014.
    33 changes: 33 additions & 0 deletions gistfile1.swift
    Original 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")
    }