DEV Community

Julien Klepatch
Julien Klepatch

Posted on • Originally published at youtu.be

1 3

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:

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️