Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
import Foundation
import Glibc
/*
enum mobile {
case iPhone
case andriod
}
var userDevice: mobile = mobile.andriod
print(userDevice)
userDevice = .iPhone
if userDevice == .iPhone {
print("this is andriod")
}
enum mobile2 {
case iPhone(String)
case andriod(String)
}
var userDevice2: mobile2 = .andriod("Galaxy")
print(userDevice2)
switch userDevice2 {
case .andriod(let model) :
print(model)
case .iPhone(let model) :
print(model)
default :
print("No")
}
enum paymentMethod {
case chash
case visa
case master(String)
}
var payment: paymentMethod = .master("depit")
payment = .chash
switch payment {
case .master(let type):
print("You will pay by master \(type)")
case .chash:
print("You will pay by chash")
case .visa:
print("You will pay by visa")
default :
print("No")
}
*/
enum paymentMethod: Int {
case visa
case chash = 3
case master
}
print(paymentMethod.master.rawValue)
enum months: Int {
case january = 1
case february
case march
case april
}
print(months.january.rawValue)
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more