SWIFT 학습노트 02

1,//아래의 이 부동 소수점 글자의 양은 모두 10진법의 12.1875와 같다.
let decimalDouble = 12.1875
let exponentDouble = 1.21875e1
let hexadecimalDouble = 0xC.3p0//==12+3*(1/16)

2,//유형 별칭, typealias 키워드로 유형 별칭 정의
typealias AudioSample = UInt16
var maxAmplitudeFound = AudioSample.min

3、//원조
let http404Error = (404, "Not Found") // http404Error      (Int, String),   (404, "Not Found")
let http200Status = (statusCode: 200, description: "OK") //                 
let (justTheStatusCode, _) = http404Error
println("The status code is\(justTheStatusCode)") //    "The status code is 404"
println("The status code is \(http404Error.0)") //    "The status code is 404"

4、사용!존재하지 않는 선택 가능한 값을 가져오면 실행 중 오류가 발생할 수 있습니다.사용!값을 강제로 해석하기 전에 nil이 아닌 값을 선택할 수 있는지 확인해야 합니다.
5. Swift의 nil과 Objective-C의 nil은 다르다.Objective-C에서 nil은 객체가 없는 포인터입니다.Swift에서 nil은 포인터가 아닙니다. 이것은 값이 부족하다는 것을 나타내는 확실한 값입니다.모든 종류의 선택할 수 있는 상태는 대상 형식뿐만 아니라 nil로 설정할 수 있습니다.
2014년 06월 30일

좋은 웹페이지 즐겨찾기