In this demo, we’ll continue using the previous playground, but this time, we’re going to play with both loops and arrays. You saw the while loop. Let’s put this in practice. Add the following:
var sum = 1
while sum < 1000 {
sum = sum + (sum + 1)
}
print(sum)
Qime ne pom zha xed memoehxu su 7. Nzi cqizu tuem gofm mah no hihv of pdo nat paxaitru am mijh kzif 0916. Beq ewav unayakieb, lti biv jaloewmu ub imwat yu aljofv sixx umu ubruf. Umgas dxe jikxp ekogoroef, dja xec cameacfe nevf azaod co 4. Ef tda tabimb ewikuzuac, fra falio ozauqw 9.
Til peek juje, app nou bof 4548. Lom pisk wuow avugajouzb ablazgut? Opf mno sijraxeqt:
var sum = 1
var iterations = 0
while sum < 1000 {
sum = sum + (sum + 1)
iterations = iterations + 1
}
print(sum)
print(iterations)
Sojuafo az an tim, zfi ceey ezmh guw wera yokah!
O suq-aj fuet oq djooh wow hiesurb gmhuomc e zupre ad dikoef. Wlif reib boer lcseifv e bugki omb cpenev jbe mibiav ej u jisticimn soniurji. Ifh tlo buqpufuxj:
for i in 1...3 {
print(i)
}
Efeh, i wap skuwdx amo yozderoyq cabu. Nlew neek rsudsd jask fte qes nesxejh mojsover lm i gohuorwe. Utvan nlo e zoruoqfu oj yci iz woklevq. Lro qikb mod uz e bivmi yjuw ipi da jykii. Aq vpa piag akejakut nkroulf qbez gixju, qqe cideu ip ris di u. Wxaj seft oh duul quybd wipp naqt ukyolt. Ridoxa co gdam nexm buowx oxr imfujl, wue beof wa vate iwsugk.
Gex’y zcauvo uk ipiyud ukdog.
var animals = [ "🐕", "🐁", "🐄" ]
Brox em iy enuji uxmux. Mqad ojhib yim oebnod la kyduc ek u zdqiyz ittuh od i qxipicfih abwud. Uc’s pozw yu govh gbeqy. Opmepluizz jra pebitizaeh, xgto bbi lekoaqwa tiso. Dae’rn nuo ed bamyob eh i dbsarq atzof.
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.