전체 글134 two list -> dict keys, values = [], [] keys.append('a') keys.append('b') keys.append('c') values.append(1) values.append(2) values.append(3) mydic = dict(zip(keys, values)) 2024. 2. 27. 22 Confusing Phrasal Verbs 1. fill in on vs fill in for to fill someone in : 정보를 주다 -> Please fill me in on what happened. to fill in for someone : 대신하다 -> My colleague was sick, so I had to fill in for her. 2. fill in vs fill out vs fill up to fill in : 빈칸을 채우다 -> fill in the blank to fill out : 폼을 작성하다 -> fill out the tax form to fill up : (자동차, 위, 병) 등을 with 액체 로 채우다 -> I filled up my car with gasoline. 3. walk in vs w.. 2024. 2. 17. focus 발음 주의를 하지 않으면 fuck us 로 들림으로 주의가 필요 "오우" 를 신경쓰고 "커스" 를 발음할때 뒤로 당겨줄 필요가 있음. 2024. 2. 17. class class User { let id: Int init(id: Int) { self.id = id print("User \(id): I'm alive!") } deinit { print("User \(id): I'm dead!") } } id : 멤버변수 init : 생성자 deinit : 종결자 계승 inherit class Vehicle { let isElectric: Bool init(isElectric: Bool) { self.isElectric = isElectric } func description() { print("I'm a vehicle.") } } base 클래스 기본적인 기능만 구현 class Car: Vehicle { let isConvertible: Bool init(isElectr.. 2024. 2. 15. struct 내부 변수를 변경하는 메서드를 포함하지 않는 struct struct Song { let title: String let singer: String let year: Int func printLyrics() { print("bla bla blar ...") } let song1 = Song(title: "Friend", artist: "Taylor Swift", year: 2012) let wings = Song(title: "Wings", artist: "BTS", year: 2016) print(song1.title) print(wings.artist) song1.printLyrics() wings.printLyrics() 내부 변수를 변경하는 메서드를 포함하는 struct struct Song { .. 2024. 2. 15. 예외처리 do { let result = try someRiskyWork() } catch { print("Handle errors here") } 2024. 2. 14. 이전 1 ··· 5 6 7 8 9 10 11 ··· 23 다음