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!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store