π 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 <>
(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 <>
(iii)Global Variables:
These variables store information about
blockchain.
Commonly used variables msg.sender
,
block.number
, msg.data
.
Source Code <>
Top comments (0)