Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift 2.0 Functions Function Parameters Function Parameters

Aditya Gawade
Aditya Gawade
1,182 Points

having problem with calling the function

Now that we have a working function let's use it.

Call the function and pass in a value of 10 for the first parameter and 3 for the second.

Assign the result of the function operation to a constant named result.

functions.swift
// Enter your code below
func getRemainder( value a: Int, divisor b: Int) -> Int {
return a%b
}
let result = getRemainder(10, b:3)

2 Answers

David Lin
David Lin
35,864 Points

Because the function's input parameters have external names, you need to use them in the call. For example:

// Enter your code below
func getRemainder(value a: Int, divisor b: Int) -> Int {
  return a%b
}

let result = getRemainder(value: 10, divisor: 3)
Aditya Gawade
Aditya Gawade
1,182 Points

thank you. also i wanted to ask that if the iOS course on treehouse is enough to start making apps?

David Lin
David Lin
35,864 Points

You're welcome, Aditya! Yes, there's several courses in the iOS track where you build complete apps from scratch, so that will help give you a lot of experience and practice.

Aditya Gawade
Aditya Gawade
1,182 Points

thank u david. that was helpful