Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Named parameter
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Overview == A function call using named parameters differs from a regular function call in that the arguments are passed by associating each one with a parameter name, instead of providing an ordered list of arguments. For example, consider this [[Java (programming language)|Java]] or [[C Sharp (programming language)|C#]] method call that doesn't use named parameters: <syntaxhighlight lang="java"> window.addNewControl("Title", 20, 50, 100, 50, true); </syntaxhighlight> Using named parameters in [[Python (programming language)|Python]], the call can be written as: <syntaxhighlight lang="python"> window.addNewControl(title="Title", xPosition=20, yPosition=50, width=100, height=50, drawingNow=True) </syntaxhighlight> Using named parameters in [[PHP]], the call can be written as: <syntaxhighlight lang="php"> $window->addNewControl(title: "Title", xPosition: 20, yPosition: 50, width: 100, height: 50, drawingNow: True); </syntaxhighlight> The version with positional arguments is more implicit. The versions that name parameters are more explicit. Depending on circumstance, a programmer may find one or the other to be easier to read.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)