I'm trying to compile a contract in the solidity browser compiler and get this error:
Expected token Comma got 'Identifier'
person.setRent(uint256 _rent);
What is the token Comma in this case?
My contract:
contract Landlord is user {
string public landlordName;
string public physicalAddress;
function Landlord(
string _name,
string _physicalAddress){
landlordName = _name;
physicalAddress = _physicalAddress;
}
function setRent(uint256 _rent, address _tenantAddress){
Tenant person = Tenant(_tenantAddress);
person.setRent(uint256 _rent);
}
Best Answer
Tl;dr: Get rid of the uint256.
The changes I had to make to get your code working are to:
User
as your contract code refers to user incontract Landlord is user
. I renamed user to User to keep with the case convention;Tenant
as your contract code refers to the statementTenant person = Tenant(_tenantAddress);
;setRent(uint256 _rent)
in the contractTenant
as your contract code callssetRent(...)
in the statementperson.setRent(uint256 _rent);
; anduint256
from your call tosetRent(...)
.Here's the code I modified to get your code to compile correctly:
Here's a screenshot of your modified code compiling in the Solidity realtime compiler and runtime: