Lesson 4: Remix Fund Me @ Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript – 32-Hour Course #2193
-
for(uint256 funderIndex=0; funderIndex<funders.length;funderIndex++)
{
//capture the address of the current index
address funder= funders[funderIndex];
//setting the amount to that index =0
addressToAmountFunded[funder]=0;
}
// ******DID NOT UNDERSTAND****
//reset the array
funders = new address[](0);
Hi, I'm Ojas, in this section, I wasn't able to understand... why did we reset the array funders AGAIN if we already set it to zero in the previous block of code ? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
Thank you so much @abossofmyself for replying,I really appreciate your help. I am posting the query in just a moment. |
Beta Was this translation helpful? Give feedback.
-
@Ojas1911 : Alright this line: yeah I just read the whole thing you mentioned in the code but not in the title, so thats why I got confused |
Beta Was this translation helpful? Give feedback.
-
Hey @Ojas1911 one way to create an empty array is using
we are assigning a new empty array of type address to the funders variable which effectively means that our funders array is reset and empty |
Beta Was this translation helpful? Give feedback.
-
@othaime-en and @abossofmyself where did you guys learn web3 development ? I just started out a few days ago, I'm curious to know your experience in the web3 space. |
Beta Was this translation helpful? Give feedback.
@Ojas1911 : Alright this line:
funders = new address[](0);
means that we are resetting the funders address array.yeah I just read the whole thing you mentioned in the code but not in the title, so thats why I got confused