mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
20 lines
399 B
Solidity
20 lines
399 B
Solidity
|
contract C {
|
||
|
function g(bool b) public pure returns (uint x) {
|
||
|
require(b);
|
||
|
return 13;
|
||
|
}
|
||
|
function f(bool flag) public view returns (uint x) {
|
||
|
try this.g(flag) returns (uint a) {
|
||
|
x = a;
|
||
|
} catch {
|
||
|
x = 9;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// ====
|
||
|
// EVMVersion: >=byzantium
|
||
|
// compileViaYul: also
|
||
|
// ----
|
||
|
// f(bool): true -> 13
|
||
|
// f(bool): false -> 9
|