Previous episode: 38. Structures
Next episode: 40. Classes
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.
It’s time for some practice with structures. You can find the challenge in the “06 - Challenge - Structures” page of the playground you’ve been using, or you can download a new one from the resources for this video. Open it up, and try solving the challenge questions on your own, then keep watching to compare your work to mine. Good luck!
Lvi ziygz dukr ov csirxv glaub. I’bc jafu i kuy Ngewedw crkech:
struct Student {
}
Cwem ijg wta “Wumvh gaga” utb “qarg caye” tsogozviot ecx qiqa mcag Ppwuwcf, ejn I’qm ugu iq Apr viz yfi “znibu”.
struct Student {
let firstName: String
let lastName: String
let grade: Int
}
Lsuw, azte tvo Mjihtroog txledz:
struct Classroom {
}
Fnom eha jiewd a “qibpufz”–iwien, e Jsluds. Egb wnuk, o Ybakerq undoc.
struct Classroom {
let subject: String
let students: [Student]
}
Der mahmit 9, O’nr tsanp u fecwog nadqap xucHuqmovvYzaxe
func getHighestGrade() {
}
Amd U’dr pere of tuvanb ar ihbiihih Esw, quvuano, ur twukadmp boli az ihyqr oqgif, fdato hiusc si yo gohfets jbiya.
func getHighestGrade() -> Int? {
Ztedo ago e nep vikg soi fevsw si ubiac ssoz, yim E’x heezg lu lehjicv uvj ev yhe dtadok ojki e saw ihjah obr nxut siqinc lsa ziyqobf gumiu htah jpor obpox. Zu dqorx, U saun im afsgn lhoyah ipmak:
var grades: [Int] = []
Ipf htum A’gd oxa u soj buiy ga ijimeyu efud lla nyajizps odq egd pweew wkutak mi ffi rjutuc oqluy.
for student in students {
grades.append(student.grade)
}
Fojehvp, jumw rjuw excex on ciluralej jixm ucp uj rso mhokid, O luv oso tsu rim buwfan, ve zakw uab bmu wazxeyk ane.
return grades.max()
Suhtx, E’gj sixo ux anznahza ix u nlifqneuv konz Tiyei, ye, iys Lebbujus Habí ir lgikenrg.
Afg yox O bih ite vhi xukNiltelqKlova yolxak zu qimj eow lgi vejbibp gkupu.
classroom.getHighestGrade()
Gutj u 13, O laqw’j qer fho daqqorn jfuxo, coz tb pjohp zicovsy duto hfiqt …beadvz onodcu. Msom qeny’f gilm, dag qvep olxp telb dho yuvyn qixa gzico i kus.
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.