Skip to content

Commit

Permalink
Fixes small nits
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantina Blazhukova <[email protected]>
  • Loading branch information
konstantinabl committed Oct 18, 2023
1 parent caefd31 commit cec5b85
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions contracts/solidity/control/ControlStructures.sol
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

contract TestContract {

constructor() {}

contract TestTryCatchContract {
function myFunc(uint x) public pure returns (string memory) {
require(x != 0, "require failed");
return "my func was called";
Expand All @@ -13,10 +10,10 @@ contract TestContract {


contract ControlStructures {
TestContract public test;
TestTryCatchContract private testContract;

constructor() {
test = new TestContract();
testContract = new TestTryCatchContract();
}

function testIfElse(bool condition) external pure returns(bool) {
Expand Down Expand Up @@ -78,7 +75,7 @@ contract ControlStructures {
}

function testTryCatch(uint256 condition) external view returns(bool) {
try test.myFunc(condition) {
try testContract.myFunc(condition) {
return true;
} catch {
return false;
Expand Down

0 comments on commit cec5b85

Please sign in to comment.