Learn Courses My Dashboard

Day 1: My Journal

Lesson 7

I know I should be on lesson one but I just found out about this forum page and I would like to post some of my progress along the way.

So so far everything has been pretty understandable with no hiccups.

However now I am in lesson 7 where Chris teaches us Functions.

Now creating a function is pretty simple to me. I understand the value of a function. being able to create one and call one out whenever necessary is I’m sure very useful in the long run.

However where I am having dificulty processing is when he starts to talk about Parameters.

I’m so lost as to what the benefit is, also understanding the code and seeing why we need to sending data into the function in the first place. haha I’m not even sure what I’m talking about right now.

I’m already on day 3 on just this lesson and I’m hoping by today I’ll have a decent grasp as to what is exactly going on in lesson 7

Also, I would love to build a community on this site. I’ll be messaging others in their forums but feel free to reply to mine so we can build a relationship as coders.

Have a blessed day everyone :slight_smile:

Lesson 8

I feel that I am finally starting to gain a grasp of these things. Or atleast learning about structure to me was very straight forward.

I hope it was the same for everyone else

I will say though I am really am eager to start applying this knowledge to an app. I know I have only a few more lessons before we start but I am very excited to see how all this applies to the app we will put together here shortly.

Have a Blessed Day Everyone :slight_smile:

Parameters are for passing data to a function!

A function is just a piece for code that can do something.

For example:

func hello() {
   print(“hi”)
}

This function just prints “hi” to the console.

func addNumbers(a: Int, b: Int) {
   print(a+b)
}

This function can accept 2 parameters pieces of data, that are of type integer.

When ran it’ll print the sun of those two numbers.

to call it: addNumbers(a: 3, b: 7)

The result of that function will be 10 Printed to the console.

You function is just an easier way to run code rather than constantly copying your code all over the place. Make a function, write it once and you can call it repeatedly!