DEV Community

Pushkar Mondal
Pushkar Mondal

Posted on

1

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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay