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 Scope

Is there a point in not having an argument without a label?

I mean, the code looks definitely cleaner if you write

someFunction(1, 3)

than

someFunction(value: 1, divisor: 3)

however, later with big projects it seems a little bit contraproductive as you will easily forget what these arguments stands for and you will have to find it.

So, is there any rule when we could/should should an argument without a label?

1 Answer

It's about personal preferences, but I'd use no labels for 1 or 2 arguments and use labels for 3 or more arguments.

It's up to you!

That's pretty clever, I have to say :)