Search code examples
blockchainethereumsolidityopenzeppelin

What does ! mean in Solidity?


I'm studying Solidity and I couldn't understand what does [!] mean in ⑨⑫⑬.

What does it mean? And, how to use it?

Could you give any advice, please?

function sendReward(uint256 _reward, address _dest, uint256 _id) external 
  onlyOwner {
        require(!rewardSent[_id]); // ⑨
        require(_reward > 0); // ⑩
        require(address(this).balance >= _reward); // ⑪
        require(_dest != address(0)); // ⑫
        require(_dest != owner); // ⑬
        rewardSent[_id] = true; // ⑨
        _dest.transfer(_reward);
        emit RewardSent(_dest, _reward, _id);
    }

Solution

  • According to the documentation != is the inequality operator. The following lines all evaluate to true:

    1 == 1
    1 != 2 
    1 != 3