Menu
Coddy logo textTech

Addresses

Part of the Fundamentals section of Coddy's Solidity journey. Lesson 41 of 53.

An address identifies an account or contract. It stores twenty bytes and is distinct from an integer or a string. You can compare two addresses with == or !=. This lesson uses address parameters as identifiers without sending money or making external calls.

The statements in this excerpt run inside the provided main function.

address first = address(7);
address second = address(9);
console.log(first == second);

The example creates two different small address values for practice, so equality is false. Real account addresses are normally written as hexadecimal values. address(0) is the zero address and is often used as an unset marker.

Use address for an account identifier and == to compare two addresses.

challenge icon

Challenge

Easy

Print whether account equals the zero address.

The tests pass arguments to main in this order: address account. Each test starts with fresh contract state.

Use console.log for the requested output. Print only the requested values, one per line, with no extra labels unless the task specifies them.

Try it yourself

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import "forge-std/console.sol";
contract Main {
    function main(address account) external view {
        // Write your solution here.
    }
}
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals

Practice on your own: Solidity playground