Konu için teşekkür ederim.
Yararlı Olmuş
Yararlı Olmuş
let statusCode = 404
let statusMessage = "Not Found"
/* statusCode adında bir int değişken ve statusMessage
adında bir string değişken oluşturup değerlerini atadık.*/
let (statusCode, statusMessage) = http404Error
/* bu iki değişkeni bir araya getirerek http404Error adında
bir tuple oluşturduk */
println("The status code is (statusCode)")
// ekrana "The status code is 404" yazdırır
println("The status message is (statusMessage)")
// ekrana "The status message is Not Found" yazdırır
println("The status code is (http404Error.0)")
/* burada tuple'ın ilk elemanına ulaşılıyor
ekrana "The status code is 404" yazdırır */
println("The status message is (http404Error.1)")
/* burada tuple'ın 2. elemanına ulaşılır
ekrana "The status message is Not Found"yazdırır. */
println("The status code is (http404Error.statusCode)")
/* yada direkt olarak tuple'ın bileşenlerine de ulaşabiliriz.
ekrana "The status code is 404" yazdırır */
println("The status message is (http404Error.statusMessage)")
// ekrana "The status message is Not Found" yazdırır