I am trying to compile the following program:
pragma solidity ^0.5.1;
contract MKotET1_1{
address payable king; uint public claimPrice = 100;
function calculateCompensation() public returns(uint) {
}
function( ) external payable {
if (msg.value < claimPrice) revert();
uint compensation = calculateCompensation();
if(!king.call.value(compensation)("")) revert();
king = msg.sender;
}
}
I am getting following syntax errors:
solc MKotET_stackExchange.sol
MKotET_stackExchange.sol:12:14: Error: Unary operator ! cannot be applied to >type tuple(bool,bytes memory)
if(!king.call.value(compensation)("")) revert();
^——————————–^ MKotET_stackExchange.sol:12:14: Error: Type tuple(bool,bytes memory)
is not implicitly convertible to expected type bool.
if(!king.call.value(compensation)("")) revert();
^——————————–^
Somebody please guide me how to remove the above syntax errors.
Zulfi.
Best Answer
Try with this:
From docs: