Named Parameter - Overview

Overview

A function call using named parameters differs from a regular function call in that the values are passed by associating each one with a parameter name, instead of providing an ordered list of values.

For example, consider the following Java method call that does not use named parameters:

window.addNewControl("Title", 20, 50, 100, 50, true);

Using named parameters in Objective-C, the call can be written as:

[window addNewControlWithTitle:@"Title" xPosition:20 yPosition:50 width:100 height:50 drawingNow:YES];

The Objective-C version is more explicit, while the Java version is more concise. Depending on the particular instance, a programmer may find one or the other easier to read.

Read more about this topic:  Named Parameter