0

I'm a beginner of solidity. I just create uint abc array and declare a public variable layercount and want to assign initial value of this. However, the error code as the topic is prompt up.

So, how can I assign initial value to the variable? And please tell me why what I did is wrong.

contract class21{

    uint [12] public abc;

    uint256 public layercount;

    layercount = 0;

  
}```

1 Answer 1

0

just do this

contract Class21 {
  uint[12] public abc;
  uint256 public layerCount = 0;
}

always assign the inital value like that. Later if you want to change that value make a function that sets it to be what you want

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.