mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #903 from mocamircea/patch-8
Update control-structures.rst
This commit is contained in:
commit
dbc95570cb
@ -87,8 +87,7 @@ parentheses at the end perform the actual call.
|
|||||||
Named Calls and Anonymous Function Parameters
|
Named Calls and Anonymous Function Parameters
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
|
|
||||||
Function call arguments can also be given by name, in any order, and the names
|
Function call arguments can also be given by name, in any order.
|
||||||
of unused parameters (especially return parameters) can be omitted.
|
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
@ -99,12 +98,20 @@ of unused parameters (especially return parameters) can be omitted.
|
|||||||
// named arguments
|
// named arguments
|
||||||
f({value: 2, key: 3});
|
f({value: 2, key: 3});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Note that when calling the function, the argument list must match by name every parameter from the function declaration - though in an arbitrary order.
|
||||||
|
|
||||||
// omitted parameters
|
Also, the names of unused parameters (especially return parameters) can be omitted.
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
contract C {
|
||||||
|
// omitted name for parameter
|
||||||
function func(uint k, uint) returns(uint) {
|
function func(uint k, uint) returns(uint) {
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.. index:: ! new, contracts;creating
|
.. index:: ! new, contracts;creating
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user