Within these castle walls be forged Mavens of Computer Science ...
— Merlin, The Coder

## Parameters, Arguments, and Labels

Consider the following function definition:

```func addTwoNumbers(a:Int, b:Int) -> Int {
return a + b
}
```

Examine line 1, specifically the parameter list, `a:Int, b:Int`. "a" and "b" are termed the formal parameters to the function. Within the function body these formal parameters take on the value as specified by the caller when the function is invoked. By default, "a" and "b" become the external labels for the caller.

Now consider the following function invocation:

```addTwoNumbers(a:7, b:22)
```

Examine line 4, specifically the argument list, `a:7, b:22`. In this case "a" and "b" are the external labels, and the argument value of 7 is used for the parameter labeled by "a" and the value of 22 is used for the parameter labeled by "b".

It's important to understand that this relationship (label first, a semicolon, then the argument value) holds regardless of the actual value specified. Consider:

```let a = 7
let b = 22
```

Examine line 5 and line 6. Each defines an Integer constant. The constant "a" is assigned the value of 7, and the constant "b" is assigned the value of 22. Line 7 then invokes the function "addTwoNumbers" with two arguments. The argument list is `a:a, b:b`. The first "a" is the argument label, the second "a" is the argument value, a constant named "a" with the value of 7. Likewise, the first "b" is the argument label, the second "b" is the argument value, a constant named "b" with the value of 22.

Consider the following function definitions:

```func addTwoNumbers(a:Int, b:Int) -> Int {
return a + b
}

func addThreeNumbers(a:Int, b:Int, c:Int) -> Int {
return a + b + c
}

func addFourNumbers(a:Int, b:Int, c:Int, d:Int) -> Int {
return a + b + c + d
}

```

Note that the only difference between these functions is the number of parameters that each allows; the intent of each function is the same, i.e., to return the sum of the arguments. We have some syntactic sugar that we can use in these cases. Overloading enables us to use the same function name with a different parameter list, rather than force us to select different names. Continuing with our example, we may define the same functions as:

```func addNumbers(a:Int, b:Int) -> Int {
return a + b
}

func addNumbers(a:Int, b:Int, c:Int) -> Int {
return a + b + c
}

func addNumbers(a:Int, b:Int, c:Int, d:Int) -> Int {
return a + b + c + d
}
```

These functions may then be invoked as:

```print(addNumbers(a:7, b:22))