Solidity vs Javascript arrays

jklepatch

Solidity arrays… are like Javascript arrays, right?

Nope..

In Solidity:

  • Arrays can only contain data of the same type (ex: arrays of integers, array of booleans, but not arrays of integers AND booleans..)
  • Arrays can be in storage, or in memory (persistent and non-persistent)
  • You can use the `push()` method to add elements ONLY for the storage arrays

I have created a short video tutorial with all the point above and many other tricks and tips for manipulating Solidity arrays.

Check it out, it’s free

By the way, in Dapp 30, where we create 30 smart contracts in Solidity where you will have a ton of practical experience manipulating arrays and advanced Solidity patterns. Check out the curriculum here.
 

More great articles

What is Ethereum Gas? Dead simple explanation

When you develop decentralized applications, you quickly stumbled upon this weird concept of "gas". That's very confusing for a lot…

Read Story

Updates added to “Learn Ethereum Dapps” ebook – v1.1.0

Last week I released my ebook Learn Ethereum Dapps, where I teach how to build a ToDo list Dapp on…

Read Story

Introducing “Smart Contract 30”, a 30-day course on Solidity

Are you a beginner learning Solidity? Are you overwhelmed by the complexity of developing an Ethereum smart contract and don't…

Read Story

Never miss a minute

Get great content to your inbox every week. No spam.

    Only great content, we don’t share your email with third parties.
    Arrow-up