var jes: Int? jes = 10 if jes != nil{ let jesro = jes! print(jesro) } if let jess = jes { print(jess) } var anotherWord = "good" print("word : \(anotherWord)") var arrWrite = ["one", "two", ] arrWrite[0] = "changedOne" let writeDown = arrWrite[0] print("Array is \(writeDown)") var arr : [String] = [] arr.append("look") arr.append("look") arr.removeLast() print(arr) func jesro(number: Int){ print(number) } jesro(number: 20) func jesro() -> String{ return "good" } print(jesro()) func jesro(_ number: Int){ print(number) } jesro(30) func jesro(getg number: Int){ print(number) } jesro(getg: 550) enum Jesro{ case jes,book,music } var goods: Jesro = .book print(goods) enum Jesr: String{ case jes = "wall" case book = "achieve" case music = "play" } var goodshow: Jesr = .book print("\(goodshow) \(goodshow.rawValue)") enum Jess{ case jes(String) case book(Int) case music(Bool) } var fell: Jess = .jes("man") print("\(fell)") switch(fell){ case .jes(let genre): print("\(genre)") case .book(let bpm): print("\(bpm)") case .music(let mus): print("\(mus)") } struct Movie { var title: String var releaseYear: Int var director: String func movieBoys() -> String{ return "\(title) is created by \(director)" } } var name = Movie(title: "Rocks",releaseYear: 2019,director: "John Smith") print(name.releaseYear) print(name.movieBoys()) //struct value types //class reference types //dictionary unordered collection var dictionary = ["keyone":"username","keytwo":"password","keythree":"lock"] dictionary["keyon"] = "users" if let valu = dictionary["keyon"]{ print(valu) }else{ print("Not Found (404)") } var dict: [Int: String]
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more