Skip to main content

Posts

Showing posts from February, 2019

Enum & Enumeration in Swift 4

An Enum & Enumeration consists of integral constants " An enumeration is a user-define data type which consists of a set of related value" Is used to define enum keyword"  enum type { const1, const2, const3, .......} enum week {           case Monday           case Tuesday          .....          case Sunday } Swift Example :- enum Country {    case India    case America    case Russia    case Chaina } var power = Country.America power = .America switch power {    case .India:       print("India Country is No 4")    case .America:       print("America Country is No 1")    case . Russia:       print("Russia Country is No 2")    case . Chaina:       print("Chaina Country is No 3") } Output is America Country is No 1