Replies: 3 comments 6 replies
-
When I went through that lesson, I never tried writing it I am not sure of your programming background and knowledge, so my answer maybe overly verbose.... Solidity is what's know as a strongly typed programming language. That means that we have to tell the Solidity compiler what type of data it is working with. Types in Solidity include uint16, uint64, uint256, string, array, struct, mapping...... line 4 in your screen shot line 9 Line 16 So we need to tell the compiler that we have this idea of a Line 16 dissected:
Without
let me know if that explains why we need line 16. |
Beta Was this translation helpful? Give feedback.
-
Hello! I am getting an error in the code below while compiling: pragma solidity ^0.8.8; contract SimpleStorage { While compiling this code I am getting this error: Please tell the solution. |
Beta Was this translation helpful? Give feedback.
-
How do I change this discussion to SOLVED?? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I'm working my was through the solidity course with very limited knowledge of coding.
I was hoping someone could clear up the formatting of the function for me and shed light on what it is I cannot grasp about the formatting.
Line 17 pushed the simpleStorage variable into the array. Got it!
Line 16 creates a new contract using the SimpleStorage.sol import then assigns it to a variable named simpleStorage but why does SimpleStorage need to be written before hand. Why can't you just write simpleStorage = new SimpleStorage()?
Also is there any reason why line 17 shouldn't just be written as:
simpleStorageArray.push(new SimpleStorage();
doing away with line 16 all together.
Hope someone can clarify the first question mainly about the context of that first SimpleStorage entry.
Beta Was this translation helpful? Give feedback.
All reactions