0Pricing
Web3 & DApp Development Fundamentals · Lesson

Variables & Data Types

Explore Solidity's fundamental data types (uint, address, bool, bytes) and how to declare and use variables within smart contracts.

Variables & Data Types: The Basics

Welcome to Lesson 2! In Solidity, just like other programming languages, we need ways to store and manage information.

This is where variables and data types come in handy. They are fundamental for building any smart contract.

  • Variables: Think of them as containers that hold a specific piece of data.
  • Data Types: Define what kind of data a variable can hold (e.g., numbers, text, true/false).

Storing Whole Numbers: `uint`

The uint data type is used to store unsigned integers. 'Unsigned' means they can only hold positive whole numbers (including zero).

  • uint can range from uint8 (8 bits) up to uint256 (256 bits).
  • uint256 is the default if you just write uint.
  • These are perfect for token balances, counts, or IDs.

All lessons in this course

  1. Introduction to Solidity
  2. Variables & Data Types
  3. Functions & Control Structures
← Back to Web3 & DApp Development Fundamentals