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 Functions in Swift Adding Power to Functions Function Parameters

Adrian Yao
Adrian Yao
1,002 Points

The editor says nothing is wrong?

I am confused because i have external and local names a for value, and b for divisor. Help is appreciated, thanks!

functions.swift
// Enter your code below

func getRemainder(a value : Int, b divisor : Int) -> Int {
  let remainder = value % divisor
  return remainder

}

1 Answer

Hurkan Dogan
Hurkan Dogan
8,099 Points

Hello Adrian,

You are doing great but there is extra lines in your code, that you dont need..

You have to use the opposite of the external and local names.

And task not wants you to create a constant in function, in this task. You just have to calculate remainder of two integers.

Hope that helps.

 func getRemainder(value a: Int, divisor b: Int) -> Int {

     return a % b
}

// In second task that will ask you to use your function as a constant.

let result = getRemainder(value: 10, divisor: 3)
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi Hurkan! I took the liberty of changing your comment to an answer. This will mark the question answered in the forums as well as make your answer eligible for voting and/or possible assignment of "Best Answer". Thanks for helping out in the Community! :sparkles: