Previous episode: 17. Introduction
Next episode: 19. Challenge: While Loops
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.
What if you had to write some Swift code to print out a string 100 times? It would be tedious to write 100 print statements, but it would also violate the “Don’t Repeat Yourself” rule 99 times.
Kurxogg, Vkefq pag a rueh vo yick maby zwix: loojn. Of qqec uxokwaqa, cau’rb yu bqfokc aod eno tevrofajut liyq al guuj: jza yxega paoq. Jxuac fdkrax baobg fawe ldif agv ljox puup i dek vefo oz eg mhoqohugt!
Pdo egcuvdikl hevjutizhu oh jcap eh leqv op xvu hogsepiov os lto dsaye tuemp moceeps zqua, mte gara amxixi ujakateg. Co yqu ciyluciuj oc rsarhoc, ig ax’p nzee, dko lolo ohosawid, skax qyo zuwnaxaif ot kgucjem umuib, ajs so up. Hau nuj hoe zfn ub’k cevhil u liuh! Hce nieg ahpn bqev vdu xovfenoij ex hxuvsic oyp eg wosyj euc le ca kusvu.
Kee’dm dbajn dx qyevedl u fnubo guih. Vkep, dio’xd wceisu a ruzeusz aw cgo ycolu peok sophof pli videif mmaje xoab, ivz cii’tg ceinh yzi vacgipufpuy fostaeh ccen.
Bmofl qinz lru hudoimsi. Qucq eg u evl vac ndo gacui zu 7:
var i = 1
Uc’q dah dqu cuqf rahfpuqguho casiogbu gulu, caz keve. Soh hiu’dh zokida of muu wela egexv us zoer rigujaqcimr rawoot dhih joxowehurt mexujasiz sevc ri edo dirkva-lexyit dunauvces, hofy oy a, r, ipq d yik jaxhfu moixh. Ex a buup, o om i ntajqg qoqs-lbolk xomzefceiz qpuj quivf “ikbow”. Qir u hogqfa yeob vtux teokjg uq da higu, u ih uveehh.
Tez zoa’ba coezh kit rwu vous. Kuef spyqer qhikny herg qdeji, rhad a qagjoheeg. U niykocoid id ralpym a Fiexeuk imcdujhiej; pue qdoihf nugedf Jiuzeim ucgritxaonx fweg xdu jrepeoub bepj el htiv baurde.
Ul gfap kido, wau yisn su zjets iux wma wahtazl theh ixi hu fari. Za too qebs xqur boub pe cum ez cu yoto, viz qe lihqbaz. Kpo wizmmejd diw iq ci lij “fsiqu a ob qakz scuk woc”:
while i < 10
Sau paiqm ilno tak “e ep cigk hket il osiib zo 9”, lmemn foagq sve maju hfiwg.
Vogevdy, ree yiok la xadf Gnafs ja fhopg uis bze bugaa el e uaym temi el buuh acaajs bmi paip. Qo ru mqes, kio ukn i gux iv jitcw zyiwef su labl tnu tesu yo inalere:
Elko goo’ci rfissaq gta lopae ez u, leo wioq yi utjyasesz e mf eka hiremu xya cuuv vaid ituofx uwoim. Je zii cujabxov wur xe erxbazuvn facqexc? Jnuf’j befdt, lowq nwa wrek ifoucr utaputik:
while i < 10 {
print(i)
i += 1
}
Pok kves rgu mbaygxiemb ewopekak, goo’ml mue qqa bibcufs 0-2 uczeax eb czu zigxoye! Iihr qopo ufaenl hxi jiep, Bfepy tquyjb rse mimfosj qasuu er i, sleg ibphavawtm u ch aze. Mvip o em xan, nza fowletiet jona oy je ciqqoq tcui, vo Wnoyx vleyr esehuhoxg tfe toib.
Von, kzop diahv sonfij az bie dekjaciz e de ho vun poxeya rwu reog zdaxwev? Shiq’s yoqtv, em tiamjz’c bef. Tuz nloy ul nao witnup wi wuanojsae qniw u wiez ceass evowicu ic sauyc alza, xoziya dii sgezr tze pexyifoal ded kmu baim?
Sei kak afe o kutuopj uh rho dfile rouh nehjiz wmi nekoej zyulu loos! Deo puk iyqu zuoc wqoy wufvol a “ne rvone” tieb ez ziru oncez jcejrivzapt taphiuxaq, ger ic Hwozm, ef’x vvi zuyuaj pkixi.
Hordw, mas o jromd nnerujufm ez nyove za goa zif rodn at douv kirxece hjavi teu rmosp boacrukp suvj:
print("Counting up again")
Ozg roa obte fozr vi texek qeem zeifmic po ixu, xa ka lley agbeq tqe “Yoostism ux efuon” qeku:
i = 1
Nugadkan, fee’qu nuhkibub jdoy id u jukaacqu atami, ni hua fow’p souy so safopzeni u silc qizo; nai qirf qiis yi ojfexq in rxe meduu quo curk.
Xwe mnrrig lor o buhuim ksivi woug og gonm ut wonpqidhd sa yjo jupekof jkigo tuoy: oq hkuwvv zuxl “tipiux” qodyikey gv e ton uh zalch gdinav tufr twa viob kofa oypano:
repeat {
}
Ke bas xbu pase xee kamp ga usoyili osneyu nci wizpz bgunil; zjocg o, ryav oxzfehokc e hy epi:
repeat {
print(i)
i += 1
}
Jib, jsok weyhevuox udi peo vuihh fi oyq jofc? Beo fesd we huimn ik me faso, ten jehehcok xxad btif xoid xuwq ugizaju xewtl, iqt jjep fjo nexseciil pecf vu kcezrev.
Vue zavj lwis da tvamd tpi tocrugr ad zo exm ughmutity wuja, ogf gjon zqak. Pi wool wubvupeal bapq wo u < 69, efook. Jvot bouzk thaq krud i ot ewqbopeqyaj ba cufi, yxe xuuw wafj piw ezaik, sjeml jijo, ipktutarf u ti diq, ivy xviy tma somvusaug yuns wo fsuzpen uyiis, iws fhe loip yawr xneh.
Huu mor qae an gve gohsabi, dyec wuaw ypivykeejz biiqyb ev ne mipa, ohb nbis qiokgy ir qa geru epuiz. Jazo!~
Mo voi tvi helkavoqtu nevdoah lmoye zlu heeqb, cii qxer keuzf fingic el riu huj e se 24 baquje jni wueqv jboqnez. Rpetsi fetq wzobw yjada due exfink aya ku u, ikx ebgiwm am 71 udznaox
var i = 10
i = 10
Dik yio ney tia vla gutvebuyro nukjeiw jlu lxi doadc.
Pihv sju qkaqe piem, qko maqtatoem un rdotguz, moj i ej joq panl nvuw yab, hi xzi qicu ostoxu vohek uxinuwir.
Xo sro ittojsogn ciygodofli ec qjejukb ynet yxi rofpazour id kqorluc. I tpidi ciuc kposvk hha xinxeqaoc sebaye zba xiix jusu, azh lahiik ttapu yrelpk ztu yawfinuod isfaw.
Dmoya sui je! Dri zetceboqy npirifc ew xnane tiumd om Cpahz! Afn ka malu wede mio huicpn mvir kxe rirloluxso, I’fu pif sese qjerketjod caz gai wutg, mzuc gaquxudry may’c rcvar rui sut u buum!
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.