0

iOS App Development Tutorial 10 Functions Part 02

iOS App Development Tutorial 10 Functions Part 02
iOS App Development Tutorial - 10 - Functions (Part 02)

Functions in Objective-C @ https://youtu.be/nEsnXM-ek8M

Checkout the Complete playlist of iOS App Development with Objective C and Xcode 7 Tutorials @ https://goo.gl/CqAFNg

In this tutorial I want to look into functions a little bit more. I want to look in detail about how we call functions from other functions and what that does to the memory inside of Xcode.
I want to do is I want to extract a function from within dayGreeting now and show you how that function using the box diagram gets called from dayGreeting. So let me show you pulling that function out. We are call we are going to create a function called GoodDay.

we are going to start with our code, here that has our loop in day greeting. And we are going to create a new function called goodDay, that takes as an input, a sequence of characters. And it's going to just print Good, followed by which ever characters get passed into that function. What we are going to do then is we are going to use that to replace those three lines good morning, good afternoon, good evening. And we are going to instead call goodDay with the suffix of a phrase that we want to repeat. And then this way we'll create a little code reuse.

In the end of this tutorial you will see that functions can call other functions. We saw it in this example. A function can have inputs, and a function can have an output. Functions are very important for abstracting repetitive task that computers do.

iOS App Development Tutorial 10 Functions Part 02

Post a Comment

 
Top