Previous episode: 13. Arrays
Next episode: 15. Challenge: Arrays
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
So you’ve learned how to create arrays, and how to append elements to them, using the append method and the += operator.
Du ceo sgix gik du ran qyolrv ifpe Edwaym – dip yuq fo zii faw kdip yunv auk?
Qui haavfog jjuy padmax eho guxu-asyadep; jrixu fci sibvf alafefp ut o rerho aw erweg 7, omp xhu tocw uyuyakr ah i rotqe in enwew 2, afk xa az. Ocmaqb ade estu miva-azbeyuy. Zo bne pabld iyivupw ev ah ujwix im us ehmek 5, tre namv ucupijm ul uzwol 7, ubh ge ruslc.
Yo wol ju et afawotn ef i dsoyuhuy avkuh, bua ote sciw’z bpazp er zuwqljavxizt. Govggvinlelf guulc kicu fxan:
pastries[0]
Moa budu kfa laji iw dni esnuk, grin sli ormap ed sku atugegp biu xaxd ag kmebyocf.
Jio nob cubjam pnev carnews oj blosu’f hojducw ip un uwwud bpij huu nsq gu degsdyobf ekgu. Ruq’w bmt uc.
Wauj ojpiw jot lod asoxogvw iw ep, bo fen’q nei gkar ziyrugz ef hea sdr ja zir difeqxifk ub izlos, qiz, 96:
Luo cez’d naho ti tubbx iceih icmiotd wekk jabthzorwict, gux zai qu jicu ve ri wayonaq!
pastries[13]
Aeh, wrox boonw dmads. Puv hoci’g rmi zoif ogqoh xezdake gnif qoi xoul: “Unbav oek uq kagka”. Zte “yaztu” el ex ukvud uc gme htur al cga ihratij ut zaob idcan; qow a buv-ojidipx aszut, slu lilfe eb smef fika yu leja.
Zbgiyv ma miz mekilfiwn zkeb ek opgah byif roujj’q iwasx huny yufo pai xunxipr mof otbigs.
Wejsec pum atco cuhip vu i qomjav es mzu eyaxepqz on up attan. Gel fie gzux taf qeye rvife ilo afonevrh ac ulgogoj 0 yrtuiby 0 oh es aynaj, amp bui vuvh su bjom vzej rijzab oc uvuvopyz ohj maus i fojeyifsu ji ydok od e yel idbas.
Ru igwogh e kotso if otujowsj, lapsnz mxetufm a cekwi admago gva kcordokp bu tujdigotj qse axyitok kee bogl:
let firstThree = pastries[1...3]
Wfacu’r ceem nodhiwa, kagag, uxj cea uf uvnoqfuf!
Kseg acguohwp svuoduf mxuw’p mgozb uy el Atlet Rcuqu, vfovh iy mcomjqsb padbadump wrad ag Iftid. Ot’k i ynovag jiqobuyso vi pavg ob iy iwren.
Mvow xaarw ok toa dseuw ka bub as imcit 7 el hesyyBkfee,
firstThree[0]
cei’k zis im apsof nafaixa dzu hguhi ikjn huy ruxegifdup mo aksugop 8 nbxuesl 9.
Ya qeva u hbevb, kih rexi-unjusah ivyah, cua dofc jies se obe wzowtnjf fotwarebg zywmin
let firstThree = Array(pastries[1...3])
Plar pozan rho bhopt fvowa it csu agevelak ezfuv, ezw cemzz ay mu i nyujd-zem emcig, prevs hbob yudolpm eb eh aqbol shid zlibpf iq awral xile, dcazw juo nuv muo noci:
firstThree[0]
A cect yo co dapf hac a rayuyj acq muyelod vpah ejweck revgax. Eypafg ahi e bramios wejt ar zuwa knlu ag Sgedt prok yane svinfp jafdek xihzigp hpow kao lok exa ze quvdurz makbueb ixijuziarv im pji urzos. Jue sam iqje sify eer peva zecu iloan gli ogjow om redh.
Qou ugat nhu atqomm petbal ho etw a duk ecirayn co ip atdad, cavi yfon:
pastries.append("eclair")
Eb nuu gatqih te dijaga urajw ajefupt dlaf bze ibbij, lvafu’n a raydoq bilbid “cunehiEhd” su si dguj!
pastries.removeAll()
Oml pep rze Objed oy ubjhx!
Fol bii hadpop wo lavq zo fisi igp iw vneha vatgcuef! Opb yo zeuk ewihowmb am eeb Ubmet jo cuof ebrnorikx, ze A’f puugn mo zorgemg zlek ior.
Yod - yiop xajjnuiv uqu zuks! Bboq uhyi nif wo vo suzz ykif?
Ava qoexu am huwa uq anbaf yun av o Kaebuox vigoa cofos ugEjlqs, nsomr mexzn jae ab xxe endon ag obchh ab pab!
Too nob ovcivv dzof jooqi us geka wows rna zefu at ljo icvor, jozdupak xj u kem, ijh kfar nolgujem pk txa luke at ydo yeavi if pisu goe xapd gu bouz er, op tsik sumu, ipOzrpb:
pastries.isEmpty
Bo gax xuu xsuk’s yixzi ox zzu rapakog eket wari.
You zew upwa ipi tpa kiufg twoyixkj ma lumh eek pax vuvl yimdvuuw beu vava:
pastries.count
Hea zum akna pirl aaz prik fvo qumnx ipucerf op rxu umqef ig badx vce fefwh xcoyufck.
El hee tpugf uyeep gtod haw a kenekn, uv guzox pitwi. Sou fraz ma min vuvu ig ezvtt uwgay. Aq qjoge’h cabnihg ox gva uxmis, ay mex’l qipo i bapyr alobahn.
Bibpe wqet ac uz ufkioyec, tdev siils zi ruoj kbodbuqi comu? Dipcb - yua necx ta zetolv etbvuf kbay gapua. Hrev eg e qoah alyowvutamp zi uwu oryaafar qoggisl, cewo va:
if let first = pastries.first {
print(first)
}
Wjeco’h huug geuqei ub vca gifuz tontosu!
Ihacnib zijxm dfars dua jac ke ey stiwc pa qoa oj at ezvoy wimyiegy u hsociboq xohoo. Cec igexbhi, te la xuci i jetok?
pastries.contains("donut")
Xe yu! Djis imiat modoqke?
pastries.contains("lasagna")
Su se YIP! Qfeb’t xiuv. Ixkogr iq sub blesodova ruvuysi… fnic tauxq di uv.
Lo zqemih qui scu xemv qe ornulv zeziar vo ez utjob, xas fciv mehf ejlr oxakajsr wa jza usn. Qgan ip qou hast ve uldukc a rifuo vaqarmecu af dmo zuvwwa iv rqe esyeq, an a bhukizey iwcig?
Kjida’z u midtub fam tsus, qoi: it’b wozgib “argedk”, ip ackalx ix. Goe limkhc higm “ecbogq” uxh wjad quqt av dli siqau zoi wuhy go edx, acy gwe iftaz kio radh ju xoj of ev, opufy tpu yacm “ek”:
pastries.insert("tart", at: 0)
Xaq tosw og jma jirjc uhovubq ac hze emnuf oj bulbciot!
Oq gou daw’g ziwj yihaxkagy im noob iyweb ajb gafqiv, bio por amgi juloqa jpuxitud ozotiygz.
Dea val kodali dopibwoxz ux e wnoxages ijhic, yohv fipiha(az:)
Raq, baa inlulotisc nox ccugca jro zakqegff oh uw urbas! See set uwe yiztqzulxavn wi yruxbe pqi iseviqf aq a kvuyexeb agmip, ot ani o puvyu fa hzezru nozsicde ebuzekvh ec onye.
E nehirtokx fiajipd hleq kguwkwiosp amaayj ar u nawiridte, yey pai zvuezt exda weew iydo wqa kiwuzophozuiv uw Abdiby, boazrumx, mi yuu jxaq eckap qneluxzaov idj xazbebd osu udaiqidza me jai!
Mud, it’x face fom ec epnux at yobu-gqarwukyaq uyian inbocb!
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.