I'm working through the Ethernaut game and levels 6 - Delegation and 10 - Re-entrancy respectively contain:

fallback() external {
    (bool result,) = address(delegate).delegatecall(msg.data);
    if (result) {


function withdraw(uint _amount) public {
    if(balances[msg.sender] >= _amount) {
      (bool result,) = msg.sender.call{value:_amount}("");
      if(result) {
      balances[msg.sender] -= _amount;

Can someone explain what is the purpose of the if(result) check? I don't understand what "this;" and "_amount;" do without calling any methods or otherwise getting or setting any info.


2 Answers 2


The values within the if blocks basically do nothing and you can ignore them.

I believe the authors of those levels wanted to avoid compiler warnings about not checking the result of 'call' method and then wanted to avoid another warning about unused variables (result in each case) so they had to use it in an if block and then use some variable in there to not get yet another warning about an empty block.


The purpose of the if(result,) check is to ensure that .call and .delegatecall did not throw. From the docs:

call, delegatecall and staticcall: they return false as their first return value in case of an exception instead of “bubbling up”.


Not sure about this; and _amount; but it seems it's some kind of placeholders for the if statement - something to formally fill the if block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.