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

Compile Error: Missing Argument label.

This doesnt work in swift 3 anymore, why wouldnt you just declare the length aswell. because you used the same function in carpetCostCalculator and xcode gives me an error there aswell .

func calculateArea(length : Int, width : Int) -> Int { let area = length * width return area } calculateArea(10, width: 2)

When i tried to put length as an external parameter, xcode complained and threw an error. Could it be because of swift 3 or a bug

func carpetCostCalulator(length length : Int, width : Int, carpetColor : String) -> Int { let area = getArea(length, width: width) var price : Int? switch carpetColor { case "gray": price = area * 1 case "tan": price = area * 2 case "blue": price = area * 4 default: price = 0 } return price! }

1 Answer

In Swift3 when you call a fucntion you need to mention the names of all parameters. that is different from Swift 2 where you was allowed to skip the name of the first parameter. for example:

calculateArea(length: 10, width: 2)

Yeah i knew that, thats why i was finding it weired as to why it was that way since im using swift three but learning with swift 2 of treeHouse. They should really update the videos to swfit 3.