cover-img

SOLIDITY - 101 (PART 1)

Learn about basics of solidity like variables , functions in language.

17 July, 2022

0

0

0

You can read my last article about COMPILING SMART CONTRACT, here πŸ‘‡ Colmpiling Smart Contract

Let's Start

πŸ’œ VARIABLES

  • Variables are data items that is defined to store different values for the runtime of the program.
  • We have different type of values to store in program like it can be an Integer, String, Characters, boolean etc.
  • Variables in solidity are :

Integers

  • Numbers can be negative as well as positive but not decimals

Unsigned Integers

  • Numbers can only positive but not negative or decimals

Boolean

  • True or False

String

  • A combination characters. It can be a word, sentence etc.

Address

  • Its a special type of data that is used in smart contract. As EVM has an hexadecimal unique value for every accounts or smart contract. We call them address as EVM will interact with the account/contract using the address.

πŸ’œ ACCESS IDENTIFIER

  • Access Identifier means that we can decide who can access the variables/function or anything in the smart contract.
  • For Security purposes, We need to restrict the access. We do this using access Identifier.

πŸ’œ DEFINING A VARIABLE

  • We define variable in solidity as this pattern.

πŸ‘‰ Remember, We can also omit the access identifier and EVM by default will take internal as access identifier. πŸ‘‰ Remember, Always try to use Variable Name as self-explanatory. πŸ‘‰ Remember, We use " " for defining strings and ; to end any syntax.

πŸ’œ SPECIAL ACCESS IDENTIFIER FOR FUNCTIONS

  • These access identifier is just to tell EVM how the function will interact with the storage.

πŸ’œ DEFINING FUNCTIONS

  • We define function in solidity as this pattern.

πŸ‘‰ Remember, We can also omit the special access identifier. πŸ‘‰ Remember, Always try to use Function Name as self-explanatory.

πŸ’œ EXAMPLE


That's all.

In the next article, we will look why we need special access identifiers, how we can add on these variables and use it more space effeciently.

Hello, I am Tanisk Annpurna


0

0

0

Tanisk Annpurna
I love making changes that touches people's πŸ’ž | Software Developer | Web3 Enthusiast

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

Β© Copyright 2024. Showcase Creators Inc. All rights reserved.