Hi, I'm Yusuf Erdoğan Blockchain developer. Developing on EVM with Solidity.


Hi, I'm Yusuf Erdoğan Blockchain developer. Developing on EVM with Solidity.
Share Dialog
Share Dialog

Subscribe to Yusuf.dev

Subscribe to Yusuf.dev
<100 subscribers
<100 subscribers

Functions can be declared as view if it is not modifying blockchains state. In our context, blockchain state is the value of the number variable.
setNumber method changes the value of the variable so it cannot be declared as view. But GetNumber only reads blockchain’s state so it should be declared as view.
Pure methods are the ones that don’t read or modify the blockchain’s state.addTwoNumbers answers the description of pure methods.

Functions can be declared as view if it is not modifying blockchains state. In our context, blockchain state is the value of the number variable.
setNumber method changes the value of the variable so it cannot be declared as view. But GetNumber only reads blockchain’s state so it should be declared as view.
Pure methods are the ones that don’t read or modify the blockchain’s state.addTwoNumbers answers the description of pure methods.
No activity yet