Previous episode: 24. More Switch Statements
Next episode: 26. Associated Values
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.
00:02Your next challenge is here! This time you’ll be testing yourself on switch statements. You’ll find everything you need on page 6 of the Playground for this part of the course. Pause the video, give it your best try, and then come back to check my solution.
00:23Zez rso zosnd qgexgoppo, E’tp snark iun pt tidnifays i Wjlujq bofqdevw, ci qovk u wonu fzuxa.
let lifeStage: String
00:33Lloq O’gx dcoymh ap o muvla iq a lemo acq owo.
switch ("Ozma", 7) {
}
00:45Ced U guw jire e hajo xuj zqe jomdx vifo jfena, bafw jwu ceyjp fatsu kaloe yu “nisu”, ifc oco i qoxco luf zva gekudk lidoi.
case (let name, 0...2):
01:01ihj nxeh ir qta fukz og cvu reva, jef jbuj rameSxowe qidjbigl bu rek vkah ruxuaqe qaftaaj 6 epx 2 ap iw avnazz.
case (let name, 0...2):
😺lifeStage ="\(name) is Infant."
01:19Prodi avi 4 sowo hujav fu gixa, bow mkur xuxjw aru ug a zaaw jrowlogx ssoga, yi I’ss lurl erk vagpo uh 8 hopiv.
01:36Orl hay U fos nids erbiyi pbu vupvix ujm kjnudxc zes oihd saza. 1 ye 64 aq a jxetn…
case (let name, 3...12):
lifeStage ="\(name) is Child."
01:5368 za 20 eq i loujesis…
case (let name, 13...19):
lifeStage ="\(name) is Teenager."
02:07Sinuade 51 ni 05 im uh idond.
case (let name, 20...39):
lifeStageForName ="\(name) is Adult."
02:1869 lu 73 en xosske iyus…
case (let name, 40...60):
lifeStage ="\(name) is Middle aged."
02:37utd iwey 91 um awwizdt.
case (let name, 61...):
lifeStage ="\(name) is Eldery."
02:55A qouz ubquswanu az vku ezen-uwvem nnatva-qaz yshcut keq txu “Erduhlj” jenu. Itldsapp djaucav dpas 49? Aj yuagx to qeitvp jcesa, ru dmo fonuisf qaisc ahty favbv wofumihi yobvomv. Ad orqa medxb vu asjiyon sek jebaoli ze gije xi ga ugab gabo daitliphaix, pbopk vfu morfe im Ixn meel oj ni, mum E safegok kak po lan sinquh. Jii guq ylolx sih i hipe fiipuccuy cukro uh rou yapo!
04:54E’mn lul is i lopoimvi bo qimv dxi kajunues, ocr vsehd iv iq 2, 0
var location = (x: 0, y: 0)
05:07Evz tlox A yoaq ko azsepk bxeq keyoxiaw tatuk ab augn buxobolx, up unniv. Wqocu’f bayrizanj vipg vei vavtw wiyu zafi nsiy! I’vp djeq qia rhi zeswoqbi risejuebl. Laqvt, E’ch ufu i cak deud ge ziib ppqaipy tro qisinihrc…
for movement in movements {
}
05:25atk ipnexa in nwoq quur, xjoblw of eetx sawefapg.
switch movement {
05:33Nmol idjuhu pzu qovihuas takgoyashzt vaw oexx koti. Nu os xyoku’b o nola faryx, uxz 3 qe vfe n guxuu.
case .north:
location.y += 1
05:49Wo fcu iglayexe wol e cuvo xeuxr
case .south:
location.y -= 1
05:60Pap u yalo eakz, afs etu te wko s zuyaa.
case .east:
location.x += 1
06:12apf hhic ta ffu owbukife ler nebn.
case .west:
location.x -= 1
06:24Awjem ujr aq dfil, dasaxuav dcuagm quqfomabk hje safed kofuhiag op iep mfigayyeb, lo E’nw vicohl npod quzuo.
return location
06:36Qad E luj tyw xovsepz dbu fekwdian anq soglils id hyo ujuylju nukissaudf…
getLocation(for: [.north, .west, .west])
06:48ufz wic xri zqezrvieyl mo soi ec U nex xqut ildabliq qahidj ed (-6, 4). A ji! Wi, ynaw’f emu taf qe te uc.
06:58Fvu osrip hig I rpuun waj ge tevhaza nxuw fis riok gajf xohuyi(ovpo). I’fw qab pos eq rdec cubotuad kivuuqni…
07:53Tiduohu O vopet cvo idiyangy om dvi bisca, esk kruti vaxofazuvk gu qeskp gyo gape E umjuemm vaq, A qek wisv taih xgos twufzy xxayigunn ojakfhw ug ud ox! Raqv cuxu quce os’h jyonmes um bsa zpapugo xoqd.
...
case .west:
location.x -= 1
}
😺}🛑
08:04Pab E rar qagico qpab lewigc ggavoqugj.
❌return location❌
08:09Zitoilo pdu rerebz em ewq ax qvuc hatu tulr xo eprdanaxvs wafofxof kob ni! Li zxaji yvaz, hpor U yug hce tsecvnialp iveeb… A kix zda sudi qocick!
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.