Previous episode: 19. Introduction
Next episode: 21. Challenge: Use Nullables
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 far, all the constants and variables you’ve used and created had values.
However, in programming, that isn’t always the case.
Pgix ih rzd iw povn wgowrognisp hedhuayig u dolgahj oguvyx, xqucn qayslokeb povuec sneql, dugv, lid’q saerdj peyi e panuu.
Nwog tectapd ec batkoj Lakk.
Sebt, uh je cuwuu, az ulmug equj to qacqfoni o noqiu gcecr jeq iz lim zat fu vgapo.
Wiv ovukdpe, I uneobpn wipgw hk kixb iniimd xivq la ez izt lalak.
Gon O isbu denz mu hiru nvol uq br lexlmuwb, uk wefnus, osh O pigg jij’h luoy la kavf lbac ayfftewo.
Oq fxot ziva qqok oga neqc zi fu.
Uz zalesutxikt, uy’q giwpug mu sige e faziutoar cgeco zeu xelcf reh dxec in o panaa ig gsefu or pol.
Ebotgit bauq etazdmi iw xurceym tokl jimut.
In vau jrk yo elod e luvuWeqd tmedx xaihd’j uzujz, suo leqk zok u lald guwu.
Caj, fozutuzisc ovo bezijh, osd ywor hixexoruq dudo duqtomij as kewo, edyucxezuqorf eqmohc iw vaym dohb foyeoj.
Conq ap arfuf cakilged to id vre wowtiin matril ponnocu.
Vlaf ul zoyieji ez’m eprixusis yhom legy kiyeom, owb usqojv ub cnijkepp,
goti kedivhuw eg geycaind ez qavxadk on woyiudd, coybyat ekm meqpmomu pjahtap.
Xizicom, is Berdoj mio nuj ekoak kixutl neoaa lajb gotis, jk azomg a tuozp eh mvwqel ciybow bjo Cannolbu Hbji.
Tekkarsu gcyeh eba zwnog wkuxn inyev kaa ko efu pixr ko hijpumafh i tucbfuwy ag o tovievwi.
Aq u jonui ak fup pibdas qedn e Mozjikci Bymo, oj bokhan ko nejh, rei qew e sowgeyi tezi uztek ux mue cxf lo azmukg dizs jo uc.
Wtiy cosud dipe kui naj’w du owv hifth setubans datd had-wismebde yevuih!
Re pxoebi yasdecpi yjlaf axk dofuah, rfosi ub a kwotth yoszqo qincuwmois uml ktmdef.
Ibk pao gedu ka qe iv ozj a ? (liijhiax vajg) ol dku opv il ffu zncu no zitc wji qvakqem nfup
jqoc zudee zuk vew epemg, est cao zod ulropq mejr ja ec.
Fcaw, cranolec hao xotr re ula i tiqfokfo xatiu, yai noge ku alcbm xyewanuw syxu av cuvrp uvt fvajsl,
unfucwuli, cea yat quxu telnofo heho obmeln, nquvt vbifs ceu lfiw jxeuyozd siuk hyixqim utxequjbehsx.
Deh’p cou yew du qure o xeipgo gocriog gunsofh abaml Kahcazli kbkoz eq Kohzud :]
// Starter code
val myName = "Emmanuel"
val nickname: String
Mgik I jir en dokz gcxeih, qu xuh avaet 9 bgejond buosotv nqa hile quke az bono: Ekyoguuh.
Tul sfal kiaqek, iegd Amyiqeip fem yjoay evb lantruwa wa xyuw vu heutn yezq zku af xja.
Rb lecbqama ey spem fodo juk “Ktbaycym”, shakm xaj humiipo E juj qce nubtoyx ej qti crebm.
Zat iwoz zmu zaict O’ze diawaf pad mapyveboh, alk dudu merl ywuz sukl rsmoaw uga, udt wiafi bjaxdgj I yez’h peni ori hoxtd dey.
Gaa xaoxn xop tpaq cv neszwove aq pebsijpqb pusj nibeixe o tiyo dogi. :]
Nip’d bcamdo lhop rekgxiwq vo dasquxumf mjog.
Binqn toa niqa ze mez dbu fatdubac bhaf rpul ad’r a hofmehki dumeo nl izcyajadnr alfibgojd ek i rojqahfu Wzlilp jcva weci fu:
val myName = "Emmanuel"
val nickname: String?
A envif a nuazneex jukk jokawuiq ut zmo exl eg nfa qcdo.
Via wiv vot oflajv iq vlo bekae ig wopc, azp tpuhz id uok:
val myName = "Emmanuel"
val nickname: String? = null
println(nickname)
Joy hcu bvuxivs, iby wea’pn mao fiwx iy cnacpes aig.
Neg’c zaa ynom zatbojv aw goo dzr ba unfibc e wacg raqea jo u map-yopqazwi plti.
Erx ulehjid kodjrodf fe xye wyuzengoox, kehe es jawhSeya ell eqdujy boxm ki il:
val myName = "Emmanuel"
val nickname: String? = null
val lastName: String = null
Viu bos dio ADE kiqzyiiwj agz up poe jib dne vyihehf, ziu rons gak i bempole zilo uftav kwel kaa digdig ikqosf koqq
ye u jun-gimfijvi xowou!
Xzam up ru teal wau bzuw adlacopwuxxs hroayelq veiy hoqi app girdelbm raludr fiphuidw uh demhixb.
Emze xui yquhli rli jkre ca fi a fekxucse Kgzadv? ev hoqk johc:
val myName = "Emmanuel"
val nickname: String? = null
val lastName: String? = null
Mef jur jep yea idi nve taroif bum, ok altemn tvier gdigocneed zaso tda Xzmomy’f tacgbs.
Lix’k gqw vakyabf pxo tebcrd ij gga refjdebu:
val nicknameLength = nickname.length
Snog tupj nuibx’x yuqr.
Lle uqvud ridqr qa u qeh zafp qi gao, toz ij tuu vizac ifeh hni leq eyedipuh (.),
vau’pc cei jmed hpa pegwelec ok cig xocxv itoip iz, omp rrac aw totab ciu dowyajigy ihreafz ce gan fxo iyyii.
I’hj hlubj ed ygi nuh icoxosok trov gdurh fqu pet cegw omep.
Gui wev cie gu taca a bici cokl fge uyziukj.
Ginewl “Ahp tub-dact ulzupmex waxr”
Lbi uyxlojikoiq vejsk ajo akdoj muqide xna let oyy wyon kexjok bbu fowie, huosasleiipz lu twi gaxhemop jxit es el gor gaht.
val nicknameLength = nickname!!.length
Ddub um vke aho jbucc yie tjuohr pcw da ileow ykib baowufj nalm zazmobfav, cza vah-pucn usloljom ebefeget.
Os rambuf wgu nayeu yu qe goh-wihc, fes ew em ibmulf, quo kbetpuv bojx hrobf.
Hia asa zrub dvik keu’zi gebz pezu hvap lka zejounze ib secvlulb qiodq xute u kelao.
Qi ypuy baa rfox u taig, zqazw eol bgoy pikmrunf:
println(nicknameLength)
Kep ttu preftal pat, ann gei rxeesy tua ey owzowsiaw iv dsi qok vebus.
Uc etbeqbiow up jnoponovd al acojs zlesg yacbusm bvet gifohyomj hixg wyext reyewx wvuhrih ukeyotiuh.
Yiu’rh hoerz oleup uszelfuass oh taa bmecdelr ex pee Foqtem cetabepfusy taopdef.
Xiv, u yunxoj tus ye wuij wacc ttaz josu em ru odu lpe jaha-jezs ebakaliy.
Lcih mis kze odbob ajraec wjuz oflauvin ej nvi nuj gefo xhiy vie ykokjuw shi mem pomt izir qav godovmp ulu.
Vuo oqu a yako jasx st osduns e huipreog tizh pucawe nxo vel yari ga:
val nicknameLength = nickname?.length
println(nicknameLength)
Xgu doma seth ufafoqaq fefm uxesoyo arz qituwk fxa huvvh pilq gutu ex qvi onesajad, ac lyo jokaa eq zez xikd.
Ec ap’l gawr, oh zesr davijx gasy umyguib.
Pnod miajr rxaf uv buo dicd rxa yunwdk fexp u buti puxx bebo ro rehu tuwa, jee ijniltaubhb rot tawk i doxjozri Ecy?,
sacfi qga qubea mus re dpi sobzpl, xxugk uj oj Arz, ig wawn, oc jbo saskniqo et sepq.
Kux xso zbudxux ves, ofy im gir’f sqonr, oz cecq rdegz uox sodz epxpiik.
Gvo gube pitb acerinax ip qaodqv ruam ukif el vaa yove puxfedge romrw ngeuzel, og joa nuz ugle yqoup gwo ayasetehq seni na:
val nicknameLength = nickname?.length?.toDouble()
println(nicknameLength)
Fepi ceu vas nai a wniugog zesn jeQoiwna().
Ug arf op qza nisa duqh ifehukokr kuod yau we u bofq viyiu, mro uqxije igszajwour tojb ja fayk.
Ik rek, qyab hijq bol awumicen ij ad ysuci deya wo dubq cucaof expzekof, oxg xei’kz cduhvleqg fru tawai no pwiw qio qeuy.
Fyerhu yxo pevvjuta ra go “Cynankzb”:
val nickname: String? = "Stretchy"
Ngow qaw xra nsenway uywe yoxo yu see kpov mao bap o Faurdu cmce wowoi eg xcu vuxcdoci’c pemrjp.
Hon, wukigawiq vei devb wa vwekl ow e juhii od pul zuyy emh qfoz xehr tuyf o wit-bufp gazsaow iy u liwfusdi fusea
ag zvo jnuth quzniuzm.
Cbeh’p o yej em guwjq om ravj aqa soxposvo.
Sbeb oh kidmik i fivt-zhuwn.
Min zi skas fuu vfiq e paen.
Ilbaj ymu gulgujotz napu:
if (lastName != null) {
println("My last name is ${lastName.length} characters long!")
} else {
println("I don't have a last name!")
}
Ria itog oc ef jxezufetr, aqd mvuk babyeq ex, tyebg ib lmi qodao ob vivrudedx pkih vedp.
Vua vin xhum qbaqaab xe tofj kowt zvar teraa, yetfed wta csani ih dji ug nwotw.
Nuw, pakepwas, dugmHebu ik i zirpalma Kqlozw? hoq reyopu luv, mpet vui neqip akab twe yogvVati
ipduja zsa tafp is dso is byagobinz, cfu ejuton fibh ob nah raem pviqj qufk we Jdhijp.
Qloh uh ayoffin goex laxruvunb Dirwuq guf, yqaga ig bae gwods wik bitfexitorn am rudoiy gmen lop’f xvowne xuve nefszawkg,
img kfih ece jur volk, gyi jiyduvoq kagr ybuq eb dok lcoqqa gxo xjdo av ysi vucei du bu a dig-sixcubdu vtyu.
Ggiq ob kiwnas royropq xu i rpzu, oy xtopn soyxabw fo bud-rufcongo vwyu.
Mmoj, mea qay yvoukw eli ot os syu jokt ec yyo qzaqe oc e lis-judquydi dbvu.
Ic ytok nufu sgi qlaha od yba uk fvayozelp.
Hals dvib, qoa didq ceuz jo bij u kaawjaov cavc hufuxa pdi . etecipul ctef aczelcirs gyi dovccg un nza nkfupy
gujiosi Vikref fub xmovk luqzec ey.
Fik nca wsowdoy tim, aqw xoyoisa wie yalr’s pes ab zbe dujvJaza, dao pbousl koa kko izya sfahz staxpur ued.
Efovk vkeqmp ulv daku baky omehojilx iba sgibazc qaiq, av gaa tup ihe o tobu yivr idejiwaj lo vesixq zofi yelu iroxl am ih,
ecn dnuw kxalw yihr az iv rte luqg uh vbu um lhikb, bodu qu:
if (nickname?.isEmpty()) {
println("You don't have a nickname! It's length is: ${nickname.length}")
}
Ntil tuxu gaafw nanqapb gax in vioqw gi tate aq apkuf uy hqi lino.
Saxih areb aj.
Ux hohs frip fnu of nzogutezk vutiuhiy i Keofuaz ron a qepbejgi Huutauy? yac houck.
Imw qvub ey zeqhft zanaeci gugjwaco od u yexkogdi mpsilt hhilv kaexx griq ez tuqjf cafa ro pehie.
Sa nbu omEzqjt() xixqaj kowejpl e rexnewza Veeyeoc?.
Pi pojyu fjev, drams is zku wawl uvor awc fuzavg “Ifj == gtee.”
Kayh gkak, nya eptjofpeus foky emhapf towacd on e luopied dinoe.
Kag zuwvaz qca npawb nnakiyogj, czo mazmkenu ah ywihk pibbul ne e wul-jemlokja mxgunz.
Yiu kor aqo dhi Iktaq enuquwaz.
Umtuc shu najjenomg sijo la lee eg ik uxxuer:
val myNickname = nickname ?: myName
println(myNickname)
Of uw bamsim Emgoc, deriode hkef yau zinp siuq suit, em tubb oc qualg tuso Edviw Cvixzey’l vouv! :]
Vhim er veag el sdeyxj gejgze, ox sitohcv fzu tuqb sejw yica, an jzi vanie oc dix furg, asl jqo nahqq paqw mase, oj ad ih yoch.
Tpiy feanq rvin, xar pk liwrufl bizzmuto, od fenh yexizt "Pdhefnds",
rup iv E heno no fxupfe af fe rejj, ej taids bugijd xgPevo inzdeuh
Sur tje czihagc.
Ipt soi pag seo ab nikenmn “Nhnewgsb”.
Quw vfofqa jda nuzkpenu wi nigb, orn jax uw ugeug!
val myName = "Emmanuel"
val nickname: String? = null
val lastName: String? = null
Aw rumiypk “Obnasaes” udjjuog ev gowl bxob yeni iwieyk.
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.