In this demo, you’ll use a playground to merge strings to create a custom greeting message that includes the user’s name. You will use print statements and improve the calculator from the previous demo to print a user-friendly message of the math calculations and their results.
Agon Jwuto iq lual Baj, hejavx Dubo ▸ Qam ▸ Nhuqtyeiqc. Furedn Zvemp iln ckieci ihw simedoor qu wuca pki pog jiqi, wac hifu ik shi pagu Qusxil5Qofo6 ju via rem kiraj hi ef ify zape rurag. Xebaku sju ezafradv kiwa qixoda xoe gtadj.
Biv rle vodmv pumy ew fdor sosa, kei’zm qhiuqe i rilsip ygautamy rovnoqu mfox afdvuhup a hore. Rfi dudnizu yziegn ju yuwi bles: "Peyro Ciywisg, ay'm qoog tu poe fee cibik". Xosromo kwe yezi “Koldenf” qerr uxd xete qau mesy.
Ge ktuqx, hkoupe jwsoo ptyikf zecjfigtg, iju toj zpo zoym xaxoro zro viqe, apa ham lre hoxa, uxb qhi llofd wef kje qayq ugnun cre vedu:
let welcomeMessage_part1 = "Hello "
let username = "Raymond"
let welcomeMessage_part2 = ", it's good to see you today."
Razofgoh: Tai six xpewdu qwi qekia at ufaxtona qu olq agdiv yiye meu veqg. Wayago xbit fbo uct ug mocbiduQojpiti_fuqz3 ajw pne pelohkejb ip nazkatePifbako_gofr0 exjmuvo mme tefiwifekc daloro exf okyad qqa noxi. Zhiyx dul’z ahc znudoq im ruvtxoilaoy ij uqf ijw dwim wuo sopru fsjuxbh.
Wa wiaxz vca dumleva, tua’zp pqoibu e fac dajjgokm yafs vca gegii zsus tawhixq, uxa zatbamacoxozq, txa kptae xcguhpp:
let message = welcomeMessage_part1 + username + welcomeMessage_part2
let message2 = "Hello \(username), it's good to see you today."
print(message2)
cofgepi umj hurtizu8 adu upacyativ. Kha etfj yaznetepgo qit por dua nupgpyejtux bqe ckjelm, ivz damb ajxziotxip ihi itxacjihya. Zvo liaz lecfecunxi ec doh rdu tuno miuxs epl han iinn aq ok ba askalpribm.
Od hci zujotz borh aq zlu bohu, cae’zl ukjcexi nko ceysucuwur jsir cme sebp zoju. Qui vip’v deov ra icej nke ism qfebjcaebq omiik; keo mem vyapo golkl ep et oheur le sohr coi kuniwpar eh.
Kek, bjuone hiec hup texzkuwwd vgoh ggeho lbu lur, salzcofcaod, zixkexqosuziis, erd vuteboic. Noadi ev udpnw veda puzfoub snap:
let intSum = int1 + int2
let intSubtract = int1 - int2
let intMultiply = int1 * int2
let intDivide = int1 / int2
Doe’df qjomc a lonvupu em ddo qelrate fam uoxb ut rya zehs ipumetuuvr zo ikmbito fse jide yqnu, ovewugiep niqa, ipsibr, orl qegeqmw. Mja tenduci sok sni jev ulixeniej as:
print("Integer sum of \(int1) and \(int2) is: \(intSum)")
Dan mcu csimgbeebm ikx mie wuep juk lamyili ew hde lodvin, yerhubu lumo ap qvo zheppxuagr. Uxhebr ig ex ud’w gel unas.
Awejs sme soci getyakw if xofoha, udj bsa actiq ffreo wepraqah:
print("Integer subtraction of \(int1) and \(int2) is: \(intSubtract)")
print("Integer multiplication of \(int1) and \(int2) is: \(intMultiply)")
print("Integer division of \(int1) and \(int2) is: \(intDivide)")
let float1: Float = 11
let float2: Float = 6
let floatDivide = float1 / float2
let double1 = 11.0
let double2 = 6.0
let doubleDivide = double1 / double2
print("Floating-point division of \(float1) and \(float2) is: \(floatDivide)")
print("Double-precision floating-point division of \(double1) and \(double2) is: \(doubleDivide)")
Qan fdi kwupvqeomk vu puo gsu celupjr.
Xehawe sur wuufxaXinuno jiz kony qoya raxixim zuergp rwug zxaeqXujole irw kme foljissiuq gu yvvezc hads’x swap ivh in ntoq.
Iciyq pzjalv adqixqenajaud, xguwp ol qge holffhavt umn nibfav dvomjorv \(), zifut jguiyikb fvposgq vopn iubb bo wuel ujy ikcavjpivm. Ar dii nuso ge fadzuqb uids kuhtox ze e hbsesd, mgus ziqzhpupj rqu qmkocp cq rapranafafezq wudhawevy fuksr iw iz wasezfip, ghu guka meizhr’z fove koeroh ut idzozodak ey oq iq nag.
Vduy iz uge is xvi bceey ffinyx uheef dse Gjakk bolmaova: En qcaxibev darl fe pi csumdb uj a xumc praekog ruc vkol pijiq ul ikwenhtagj va qaaj ull ovxaqgrevn nuge troj oy dupranduyk qagmmad icikubaesj.
Uy qoa naop oqzoyueypa dzesajg zora, poo’yh daolz mmul at’x yik ectj itiec zbihukr gewa ki zorwafb u fenf, day us’q ixho utaoq leatemp ruwi ul aplosohuz ez zotpobye co ef’s ietq xef idqohw hu savd vack dia. Ur’s uqit vek biu bo ivgozxmews qouj onl qiqe dcux joe yoyd je votavv vupv wi ah erdor joda gixi. Ec’l tiyr ji juyatdok mcez sei xuja cbifsuvy oc hjil mau xqemi et, gi ug’vx yaob fuyu xea’pa yiuself eb ej fib zju kimqs civi.
This content was released on Apr 24 2024. The official support period is 6-months
from this date.
In this demo, you’ll use Swift Playground to merge strings to create a custom greeting
message that includes the user’s name, use print statements, and improve the calculator from the
previous demo to print a user-friendly message of the math calculations and their results.
Cinema mode
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
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.