I am trying to run this code on remix IDE:
pragma solidity ^0.4.24;
contract Aa {
string public result;
function feedData(string _result) public {
require(_result = "e" , "error");
_result = result;
}
}
I keep getting an error: No matching declaration found after argument-dependent lookup. require(_result = "e" , "error");
I looked up the error on stackexchange but the answer doesn't solve this issue. (No matching declaration found after argument-dependent lookup)
When I change the line:
require(_result = "e" , "error");
to => :
require(_result == "e" , "error"); // adding an extra equal sign.
I get the error: Operator == not compatible with types string memory and literal_string "e" require(_result == "e" , "error")
So now my question is: How can I use require() with a string variable or is there a better way to achieve what the code is trying to do?