I had to use the newest 0.5.2 version of solidity and now I am getting these three errors, and it will not let me compile due to them. Please let me know how I can fix these. Since I’m fairly new, if you could show the code I need to replace it would be very helpful.

Errors are:

browser/Betting.sol:78:13: SyntaxError: Variable declarations can only be used inside blocks.
address add = winners[j];
rowser/Betting.sol:15:3: SyntaxError: Functions are not allowed to have the same name as the contract. If you intend this to be a constructor, use "constructor(...) { ... }" to define it.
function Betting() public {
^ (Relevant source part starts here and spans across multiple lines).
browser/Betting.sol:83:25: DeclarationError: Undeclared identifier.
delete playerInfo[playerAddress]; // Delete all the players

Need to get this done ASAP so please help me out.


Alishba Imran

I’m a developer & innovator who enjoys building products and researching ways we can use AI, Blockchain & robotics to solve problems in healthcare and energy!