solidity/test/libsolidity/semanticTests/expressions/conditional_expression_functions.sol
2019-07-01 15:37:46 +02:00

13 lines
307 B
Solidity

contract test {
function x() public returns (uint) { return 1; }
function y() public returns (uint) { return 2; }
function f(bool cond) public returns (uint) {
function () returns (uint) z = cond ? x : y;
return z();
}
}
// ----
// f(bool): true -> 1
// f(bool): false -> 2