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 age = 20 // Integer bir değerin yas adlı değişkene atandığını görüyoruz. | |
// İlk kod satırımızda değişkene bir tip ataması yapmadık.Swift bunu kendi anlayacak kadar zeki. Altta ki örneğimize bakalım | |
var languageName = "Swift" // Burada da String tipinde bir değişkeni görüyoruz. | |
// Fakat eğer istersek tip ataması yapabiliriz. | |
var languageName : String = "Swift" | |
var age : Int = 20 |
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 age = 20 // Integer bir değerin yas adlı değişkene atandığını görüyoruz. | |
// İlk kod satırımızda değişkene bir tip ataması yapmadık.Swift bunu kendi anlayacak kadar zeki. Altta ki örneğimize bakalım | |
var languageName = "Swift" // Burada da String tipinde bir değişkeni görüyoruz. | |
// Fakat eğer istersek tip ataması yapabiliriz. | |
var floatNumber : Float = 12.12 | |
var doubleNumber : Double = 10.0 | |
var languageName : String = "Swift" | |
var age : Int = 20 |
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 sabit = 2014212443 // Int tipinde bir sabit oluşturduk | |
sabit = 124343 // bu kodu denerseniz yani sabitin içine yeni bir değer atarsanız hata verdiğini göreceksiniz. | |
// Aynı zaman da sabitlerinde tipleri belirtilebilir | |
let stringSabit : String = "swift" // Ve bununda içindeki değer bir daha degiştirilemez. |
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 dizi = [2,5,1,3,4] // 5 elemanlı dizi tanımlandı. | |
print(dizi.count) // dizinin eleman sayısı öğrenildi. | |
print(dizi[2]) // dizinin 2.indisinde bulunan değeri gösterdi. | |
dizi.append(3) // yeni eleman ekler | |
dizi.remove(at: 2) // belirtilen indexi siler | |
print(dizi.last!) // dizinin son elemanını verir. | |
dizi.sort() // diziyi sıralamak için kullanılır |
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 dizi = [2,5,1,3,4] // 5 elemanlı dizi tanımlandı. | |
print(dizi.count) // dizinin eleman sayısı öğrenildi. | |
print(dizi[2]) // dizinin 2.indisinde bulunan değeri gösterdi. | |
dizi.append(7) // diziye eleman ekleme fonksiyonudur. | |
dizi.remove(at: 2) // belirtilen indexi silme fonksiyonudur. | |
print(dizi.last!) // dizinin son elemanını verir. | |
dizi.sort() // diziyi sıralamak için kullanılır | |
// Boş bir dizi belirtmek istiyorsanız şöyle yaparız |
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 isimler = ["kisi1", "kisi2", "kisi3", "kisi4","kisi5"] | |
for i in isimler { | |
print("Hello, \(i)!") // Burada String interpolasyonunu görüyoruz. String içine bir değer içeren değişkenin değerini basma yolu | |
} | |
// Hello, kisi1! // burada for da ki i dir. Ve bu index isimler dizisi içinde dolaşır. Her aldığı degerden sonra for ' un içindeki | |
// kodu çalıştırır ve ekrana basar. | |
// Hello, kisi2! | |
// Hello, kisi3! | |
// Hello, kisi4! |
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 ekranaYaz() { | |
print("Swift çok eğlenceli :( ") | |
} |
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 parametreAlanFonksiyon (isim : String , yas : Int) { | |
print("\(isim) \(yas) yaşındadır.") | |
} |
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 tip3Fonksyion (isim : String , yas : Int) -> String { | |
return "\(isim) \(yas) yaşındadır." | |
} |
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 login(kullaniciAdi username:String , kullaniciSifre password:String) -> Bool { | |
if username == "swift" && password == "1234" | |
{ | |
return true | |
}else { | |
return false | |
} | |
} |
OlderNewer