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

what should be the output

what should be the output?

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


//

1 Answer

Matt Skelton
Matt Skelton
4,548 Points

Hey Meet Ramani,

You've got your internal and external variable names muddled up on this one. Currently, your method is set up with external variable names of "a" and "b", with internal names referred to as "value" and "divisor".

You need to switch these around so that your external names are value and divisor.

Once you've done this, you'll have to make sure you're using the correct external names when calling your method. Likewise that you're using internal names within the body of your getRemainder function. Finally, assign this to a constant named result and you should complete the challenge.

Hope that helps, let me know if you need any more pointers!