DEV Community

Pushkar Mondal
Pushkar Mondal

Posted on

Solidity Saga: Day 2 Dive into the Blockchain Realm Unveiling the Secrets of Smart Contracts πŸš€ 😎 ⛓️#SoliditySprints #DevJourney"

πŸš€ Introduction to Solidity Variables in Smart Contract Development πŸš€

So there are three types of variables in solidity we can regularly use almost everywhere.

These are-
Local Variable
State Variable
Global Variable

(i)Local Variables:
Local variables are declared inside a
function and exist only for the duration of
that function's execution. They are
temporary and are discarded once
a function is completed.
These variables are not stored on the
blockchain.

Reference Code <>

Image description

(ii)State Variables:
State variables declare outside functions.
Their values persist even when

the contract is not actively running.
They can have different levels of
visibility (public, private, internal) to
control access.
This variable is stored on the
blockchain.

Reference Code <>

Image description

(iii)Global Variables:
These variables store information about
blockchain.
Commonly used variables msg.sender,
block.number, msg.data.

Source Code <>

Image description

Top comments (0)