iOS Functions in Swift Adding Power to Functions Function Parameters

Sebastian Fernandez
Sebastian Fernandez
2,413 Points

What is a module?

Hi!, I stuck in this exercise because, what is a module?

pls Help!!

// Enter your code below
func getRemainder(value a:Int, divisor b:Int ) -> Int {
    let modulo = a / b
    return modulo
Michael Hulet
Michael Hulet
Treehouse Moderator 46,961 Points

Can you clarify what you're asking a bit? You ask about what a module is, but your code implies that you mean that you're wondering what the modulo operator (%) does, and these are 2 entirely disparate and unrelated concepts in Swift

1 Answer

28,375 Points

The modulo operator (technically called the remainder operator in Swift) was covered in the Arithmetic Operators video back in the Swift Basics course.

But to offer a quick recap, it looks like the percentage symbol % and gives you the remainder of dividing two numbers. So 4 % 3 for example would result in 1.

All you need to change in your code to pass the task is to replace the / symbol with %.