[ad_1]
GET THIS SWIFT COURSE FOR FREE:

In this demo, we will talk about function in Swift. Let’s talk about it. Enjoy 🙂

Your Code Challenge:

In this code challenge, we will leverage yesterday Code Challenge to create some awesome functions!

+ Create a new playground called 7DSC-Day4-MinMaxFunctions

+ Create a new function called generate random numbers that takes in an Int called upper, the number of random numbers we want to generate called count – an Int and return an array of Int.

+ Test the new function by calling it to generate 10 random numbers less than 987.

+ Now, time to create the min function to find the minimum number of an array of integers. Create a function called get min that takes an array of integers called nums and return a value of type that you should determine by yourself 🙂

+ Implement this function. Remember the rule of finding a min / max number! Here it is if you forgot about it 😋 RULE: do not use any other Swift function like min, max to find the number. You have to use a for loop here! And do not use any other functions to sort the array. You have to use for loop! Otherwise there is no point of practicing loop 🙁 This is in red so you know that I’m seriously serious here! 😈

+ Test this new getMin function with the array from step 3 now.

+ And hey, have fun doing this!

+ Share your awesome Code Challenge solution below in the comment section, leave me any questions you have, subscribe to the Youtube channel so we can connect!

Good luck and bring the joy,

– Duc

Love even more advanced and in-depth training with me? Join Total iOS Blueprint 2 where I share with you how to build 11 iOS apps from scratch with awesome video tutorials just like these.

GET THIS SWIFT COURSE FOR FREE:

********************************
*** ABOUT CODE MASTERY ***
********************************
Code Mastery is hosted by Duc Tran, founder of Developers Academy.

This is his free-style no notes, no teleprompter presentation and live coding broadcast with you guys everyday.

To join Duc’s free courses, register for free at

*************************
*** MEET DUC TRAN ***
*************************

Duc Tran is founder of Developers Academy, one of the world’s leading iOS, Android and Web development trainers.

More than 2,000,000 developers have studied his video trainings; 100,000 developers see his posts each month. Each year, Duc has helped 20,000 plus developers gratudate from his online courses or video series.

*************************************************
*** FREE TRAININGS IN IOS DEVELOPMENT ***
*************************************************
To subscribe and get free tutorials, courses and weekly content, visit me at:
Connect with Duc on facebook:
Tweet him:
Get daily inspiration: