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 trialbronnyreinhardt
1,007 PointsFunction with two different parameter types
What if a function had two different parameter types? What would the function type be? The following function has two int
parameters:
int funky_math(int a, int b);
But what if the parameters were (float a, int b)
?
3 Answers
Paolo Scamardella
24,828 PointsWhat do you mean? I'm no iOS developer, but if you are asking what type the function will return, it would be an integer because of the int in front of the function. It doesn't matter the types of parameters as long it returns an integer. So if you had a function like string funky_match(int a, int b) and inside the function you do some kind of processing and return a string, that would be valid.
bronnyreinhardt
1,007 Points–
Paolo Scamardella
24,828 PointsNo problem...I hope this helps!
bronnyreinhardt
1,007 Pointsbronnyreinhardt
1,007 PointsThanks Paolo I think I had a mind lapse!