Programming in Swift: Functions & Types

Jan 4 2022 · Swift 5.5, iOS 15, Xcode 13

Part 1: Functions

02. Review Functions

Episode complete

Play next episode

About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 01. Introduction Next episode: 03. Challenge: Functions

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.

Learn more Already a subscriber? Sign in.

Notes: 02. Review Functions

Update Notes: This course was originally recorded in 2019. It has been reviewed and all content and materials updated as of October 2021.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You’ve had a fair bit of experience writing functions already! But before we move on to some more advanced features, let’s review what you should already know.

❤️func❤️ 💛printMeow💛💚()💚 🧡{
func printMeow💛()💛 {
func printPassStatus💛(grade: Int)💛 {
  print(grade >= passingGrade ? "You passed!" : "Glue != food.")
printPassStatus(grade: jessyGrade)
func printPassStatus(grade: Int, lowestPass: Int = passingGrade) {
  print(grade >= lowestPass ? "Good kitty!" : "Keep your paws off the table!")
printPassStatus(grade: jessyGrade)
printPassStatus(grade: ozmaGrade, lowestPass: 80)
printPassStatus(grade: jessyGrade)
printPassStatus(💛grade💛: ozmaGrade, 💛lowestPass💛: 80)
func printPassStatus(for grade: Int, lowestPass: Int = passingGrade) {
  print(grade >= lowestPass ? "You've earned a treat." : "🙃")
printPassStatus(for: ozmaGrade, lowestPass: 80)
func printHighestGrade(💛_ grade1: Int, _ grade2: Int💛) {
  print(grade1 >= grade2 ? grade1 : grade2)
printHighestGrade(jessyGrade, ozmaGrade)
func getPassStatus(for grade: Int, lowestPass: Int = passingGrade) 💛-> Bool💛 {
  return grade >= lowestPass
func getPassStatus(for grade: Int, lowestPass: Int = passingGrade) -> Bool {
  💛return grade >= lowestPass💛
let jessyPassStatus = getPassStatus(for: jessyGrade)
func getPassStatus2(for grade: Int, lowestPass: Int = passingGrade) -> Bool {
  💛grade >= lowestPass💛
let ozmaPassStatus = getPassStatus2(for: ozmaGrade, lowestPass: 80)