I have a problem in this array of struct #3417
-
struct people {
DeclarationError: Identifier already declared. from solidity: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@opemy please use backticks ( ``` ) to post your code. It's difficult to read it in the way you sent it. Use the preview tab to visualize how it will look before posting. You need 3 backticks. Example:
|
Beta Was this translation helpful? Give feedback.
-
@opemy I agree with @pacelliv, we should try to follow posting etiquette. As for the error you are getting, well the solidity compiler is getting confused.
later in your code you are declaring a variable The Solidity compiler is asking "what do you mean a variable of so change your custom data type to
and the compiler will understand that you want to use the custom data type that you named |
Beta Was this translation helpful? Give feedback.
@opemy I agree with @pacelliv, we should try to follow posting etiquette.
As for the error you are getting, well the solidity compiler is getting confused.
You are declaring a custom data type of
people
later in your code you are declaring a variable
People[] public people;
The Solidity compiler is asking "what do you mean a variable of
people
? You have already told me thatpeople
is a data type."so change your custom data type to
and the compiler will understand that you want to use the custom data t…