State Variable:
Any variable that is declared at contract level is known as state variable.
Example:
Properties:
--> State variables are stored in Blockchain.
--> During declaration, state variables are permanently stored in the contract storage.
--> A certain amount of gas must be paid.
--> Higher the number of variables, higher the amount of gas.
--> During declaration, the default value of a variable is the default value of datatype.
--> There is no concept of "null" or "garbage" in Solidity.
We can check value by:
unit public age;
When the keyword public is written, a function is automatically created (get function). By this we can access the value of the variable.
Comments
Post a Comment