I'm trying to compile the following keep getting an error, even though used this before in second code and its working fine. Simply trying to change the temp to the new temperature set by the user, so that I could call/get it from Solidity. Any help on how to fix the error or achieve what I want?
Code:
uint256 public temp;
constructor() public payable {
.
.
.
.
temp = 15;
}
event DataCommited( int256 T, string _L);
function commitTask(int256 _temp, string memory _location) public inState(State.Created) payable{
require (keccak256(abi.encodePacked(location)) == keccak256(abi.encodePacked(_location)));
require(_temp < 35 && _temp > -5, "Temperature out of range");
dataCount += 1;
if(dataCount == rewardNum)
{
msg.sender.transfer(reward);
emit TaskDone();
}
emit DataCommited( _temp, _location);
_temp = temp;
}
Working code without an error:
uint256 age;
function setInstructor(string memory _fName, uint256 _age) onlyOwner public {
fName = _fName;
age = _age;
emit Instructor (_fName, _age);
}