My if statement does not what I wanted it to be

Hi guys,

subscribed yesterday and started with the beginner course. Now I’m at the 4th video (part 4) and doing the challenge right now.
I created my little function. In there I return the tip percentage based on the rating.
It looks like that:

var rating = 5
func tipPercentageForRating(rating: Int) → Double {

if rating == 5 {
    return 0.25
} else if rating >= 3 {
    return 0.15
} else {
    return 0.10
}

}

However the return value is 0.15 (shown on the sidebar in playgrounds) no matter what the variable age is declared.
What am I missing?

Thx guys :slight_smile:

/edit: sry I was a bit too fast. I fixed and get it now. I don’t have to assign this rating variable at all. I just write the rating into the function parameter like so:

tipPercentageForRating(5)

Because you are assiging it a 5.

BTW, what do you mean by “no matter what the variable age is declared”