๐Ÿ“Œ Storage

Example:

uint public x; // this variable is in storage

function update() public {
    x = 5; // writes to storage (permanent)
}

โœ… Think of storage as the hard disk of the contract.


๐Ÿ“Œ Memory

Example:

function copy(uint[] memory arr) public pure returns (uint) {
    arr[0] = 10; // OK, can modify
    return arr[0];
}

โœ… Think of memory as RAM in your function.