4/4. Changing global variables in a loop.
By changing the global variable many times in a loop, we waste gas overwriting the data that is stored in the blockchain and this can cost a lot.
The local variable will help us save gas:
First call costs 30404.
The second 34250.
1
14
3/4. Intermediate variables.
With the help of intermediate variables, we often simplify the readability of the code, but in smart contracts this can also add cost to the execution of the function.
First call costs 43364.
The second 43390.
It's a small difference, but it's there.
1
14
2/4. Data arrays.
When you use arrays, don't use dynamic arrays unnecessarily, as they cost a lot of gas compared to fixed length arrays.
For example, calling the pushSomeData function, in the first case we pay 43753 gas, in the second 65933:
This is a really big difference!
1
13
1/4. Variable initialization.
Many people know that when declaring a variable of type uint, then by default the value 0, and if you need to initialize a variable with a value of 0, then you can not write this and save gas.
The first costs 67066 gas.
The second one is 69324.
1
14
Have you already started learning Solidity? 👀🤔
An example of the simplest smart contract on Solidity programming language:
How the setInterval JavaScript function actually works? 🤔
Everyone knows that the JavaScript code interpreter is made in C++. 👀
So, I show you how this setInterval function is realized in C++, because this is how the processor execute it. 🔥
Hello again @hypebearsclub team! 🔥
I continue to be inspired by your NFT project.
Present to you another fan art on which a lot of effort was spent. ❤️
I really hope you enjoy it! 🙏🏼
love everyone, thx ❤️
-----
@jpegenthusiast_ @TheRickk @xy_square @yura_elkin
#HypeBears
Video gameplay. @hypebearsclub
Hello @hypebearsclub! Your project has inspired me a lot. Initially,
I thought of making a beautiful art, but I decided to do something cooler and
wrote my own mini-game in the JavaScript programming language for you.
GAME: flappyhypebear.fun/
GITHUB: github.com/Mickael-Bill/flap…
1
Hello @hypebearsclub! Your project has inspired me a lot. Initially,
I thought of making a beautiful art, but I decided to do something cooler and
wrote my own mini-game in the JavaScript programming language for you.
GAME: flappyhypebear.fun/
GITHUB: github.com/Mickael-Bill/flap…










