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

I am not sure what to do in this task! I just get an error

I always get a stupid error when I try to complete this task. Can someone help me?

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

1 Answer

28,558 Points

That "stupid error" is telling you pretty much exactly what the issue is. The task asks you to have two variables with a local name of a and b, and external names of value and divisor. You currently don't define any external names. And use value and divisor as local names.

As shown in the Argument Labels video preceeding this challenge you can have a separate external and local name that are divided by a space. Like this:

func getRemainder(value a: Int, divisor b: Int) -> Int {
  return(a % b) // Since a and b are the local names I had to change this line too