Skip to content

Instantly share code, notes, and snippets.

@kadiralev1
Created March 1, 2019 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kadiralev1/9efd1daf561cc5ca79a8c17c8a2c2e09 to your computer and use it in GitHub Desktop.
Save kadiralev1/9efd1daf561cc5ca79a8c17c8a2c2e09 to your computer and use it in GitHub Desktop.
enum Aktivite {
case oturmak
case kosmak (hedef : String)
case sarkiSoylemek(sarkiAdi : String)
}
let kos = Aktivite.kosmak(hedef: "Eve koş :D")
print(kos) // ekran çıktımız kosmak(hedef: "Eve koş :D") olacaktır.
// enumlar da alt alta gelen case' lerin sırasıyla değer almasını istiyorsak hepsine tek tek değer vermenize gerek yoktur.
// Bir tanesine verin enum gerisini sizin için tanımlasın.
enum Gezegen : Int {
case Dunya = 1
case Mars
case Jupiter
}
print(Gezegen.Mars.rawValue) // çıktımız 2 olacaktır eğer jupiterin rawValuesini yazdırmak isteseydik oda bize 3 değerini verecekti.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment