This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let sehir = { | |
print("Antalyada yaşıyorum.") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func doubleInPlace(number: inout Int) { | |
number *= 2 | |
} | |
var myNumber = 10 | |
doubleInPlace(number: &myNumber) | |
print(myNumber) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func doubleInPlace(number: Int) { | |
number *= 2 | |
} | |
var myNumber = 10 | |
doubleInPlace(number: myNumber) | |
print(myNumber) | |
/* EĞER BU KODU ÇALIŞTIRMAYI DENERSENİZ ŞÖYLE BİR MESAJ ALACAKSINIZ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ornek = VideoModu() | |
ornek.cozunurluk = hd// önceki ornekte kullandık | |
ornek.isim = "1080i" | |
ornek.kareHizi = 25.0 | |
let ornek2 = ornek | |
ornek2.kareHizi = 30.0 | |
print(ornek.kareHizi) // print çıktısı -> 30 oldu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let hd = Cozunurluk(genislik:1920,yukseklik:1080) | |
var sinema = hd | |
// hd'nin değerleri sinemaya kopyalandı. | |
sinema.genislik = 2048 | |
print("Sinema genislik \(sinema.genislik)") // Sinema genislik : 2048 | |
print("hd hala :\(hd.genislik)") // hd hala : 1920 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cozunurluk = Cozunurluk() | |
let videoModu = VideoModu() | |
print("Çözünürlüğün genişliği : \(Cozunurluk.width)") // print -> Çözünürlügün genişliği 0 | |
// initial statteki atadığımız değer geldi. | |
// Bunu videoModu değişkeni içindede yapabiliriz. Çünkü VideoModu classında Cozunurluk struct'ından bir instance vardı. | |
print("Video modundaki genişlik \(videoModu.cozunurluk.genislik)") // aynı değeri verecek. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Cozunurluk { | |
var genislik = 0 | |
var yukseklik = 0 | |
} | |
class VideoModu { | |
var cozunurluk = Cozunurluk() | |
var isim : String? | |
var kareHizi = 0.0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Cozunurluk { | |
var genislik = 0 | |
var yukseklik = 0 | |
} | |
class VideoModu { | |
var cozunurluk = Cozunurluk() | |
var name : String? | |
var kareHizi = 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ornekStruct { | |
} | |
class ornekClass { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var plakaSehir = [Int : String]() // key'i int , value' si string tipinde olan oş bir dictonary oluşturduk. | |
plakaSehir[07] = "Antalya" // 07 key değerine ve Antalya valuesine sahip bir elemanı dictionary' e ekledik. | |
// eğer dictionary'i tamamen boşaltmak istersek namesOfIntegers = [:] kodunu yazmamız yeterli | |
var havaAlanlari : [String:String] = ["ADA":"Adana","AYT":"Antalya"] | |
// dictionary'i bir değişkene atadık sabite değil çünkü ilerde daha çok havalimanı eklemek isteyebiliriz | |
// Unutmayalım eğer initialize durumunda değişken atıyorsak tipini belirtmemize gerek yoktur. | |
// yani şu şekildede tanımlayabiliriz. var havaAlanlari = ["ADA":"Adana","AYT":"Antalya"] TYPE INFERRED |
NewerOlder