Subscript kavramı nedir nasıl kullanılır

in #utopian-io7 years ago (edited)

Selamlar , bu dersimizde " Subscript " Nedir , nasıl kullanılır , nerelerde kullanıldığını anlattım . " Subscript Class,Struct,Enum " elemanlara daha rahat ulaşabilmek için kullanılır . Fazla bulunmayan bilinmeyen bir kavramdır . Fakat videodada dediğim gibi apple kitabında bulunmaktadır . Anlatmak istedim . İyi seyirler , İyi dersler .

Greetings, in this lesson we will tell you what "Subscript" is, how it is used, where it is used. "Subscript Class, Struct, Enum" is used to access elements more easily. It is an unknown concept that is not found much. But as I said on video, he is in apple book. I wanted to tell you. Good looking, Good lectures.



Projemizin Kodları
(Project Code)





import UIKit


struct Arac{

    var arabalar = ["Murat","Doğan","Şahin","Serçe","Kartal","BMW"]

    

    func arabaSec(index:Int)->String{

        return arabalar[index]

    }

}

var araba = Arac()

araba.arabaSec(index: 0)

struct Arac2{

    var arabalar2 = ["Murat","Doğan","Şahin","Serçe","Kartal","BMW"]

    

    subscript(index:Int)->String{

        return arabalar2[index]

    }

}

var araba2 = Arac2()

araba2[0]

// [String:String]

// [String:Int]

class Sehirler{

    var iller = ["Adana" : 1, "Adıyaman" : 2 , "Ankara" : 6, "İstanbul" : 34]

    

    subscript(key:String) -> Int{

        return iller[key]!

    }

    

}

var sehir = Sehirler()

sehir["Ankara"]

sehir["İstanbul"]





  • Video ya ingilizce çeviri yapana " 1 SBD " Ödül verilecektir

  • The person who makes video or english translation will be awarded "1 SBD".


Videoma ingilizce çeviri yapabilirsiniz
English subtitles can be added to the video.

Kodlara github adresimden'de ulaşabilirsiniz
You can access the code file from my "Githup" account


Önceki derslerimiz / Previous lessons.**




Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @kerimcaglar I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 57653.84
ETH 2354.20
USDT 1.00
SBD 2.35