Listing 13.8 Question


#1

When we pass the arguments for the number of stoplights to townPlan, why do we not need to use the second parameter name “toLights”? I thought that when we call a function with more than one parameter, we must declare every parameter except the first.

I am referencing the following code:

stoplights = townPlan(4, stoplights)

Shouldn’t it be as follows:

stoplights = townPlan(4, toLights: stoplights)

Xcode gives me an error telling me to delete the parameter name, but I’m trying to understand WHY it isn’t required.

Thanks