How to choose the right variable in Solidity?

jklepatch

Julien Klepatch

Posted on October 1, 2019

How to choose the right variable in Solidity?

In Solidity smart contracts, there are 3 types of variable:

  • Fixed-size types
  • Variable-size types
  • User-defined types

There are many different kind of variables, but the one I used the most are:

  • uint, to represent numbers, like amount for ether / ERC20 token transfers
  • address to specify recipient of transfers
  • arrays, to represent collection of data
  • mappings to also represent collection of data but this time when we want easy retrieval with a key
  • struct to represent some structured data, like a user

The full video is available here:

šŸ’– šŸ’Ŗ šŸ™… šŸš©
jklepatch
Julien Klepatch

Posted on October 1, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related