Sitemap

DAY 17/100 OF SOLIDITY

I’m still on arrays and for loops in solidity. It gets more complicated when you go deeper.

Get Victory Chidera Ezeokafor’s stories in your inbox

Join Medium for free to get updates from this writer.

Press enter or click to view image in full size

Looping through an array in is totally different from looping through a function more than once. In that of a function, ‘i’, which is the local variable of the for loop acts as a counter — that’s used to count the number of times it will loop through a function call. But when dealing with arrays, ‘i’ acts as the index of every element in the array. you have to keep this in mind whenever you’re dealing with for loops in solidity.
I also learnt how to create a new memory array using the ‘new’ keyword.

Press enter or click to view image in full size

--

--

Victory Chidera Ezeokafor
Victory Chidera Ezeokafor

Written by Victory Chidera Ezeokafor

I'm a Decentralised Social Media Smart Contract Security Specialist.