Articles → BLOCKCHAIN → Pure And The View In Solidity
Pure And The View In Solidity
Pure Function
View Function
Example
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
contract PureViewDemo {
uint8 public state_var = 50;
function viewDemo() public view returns (uint) {
return state_var;
}
function pureDemo(uint a, uint b) public pure returns (uint) {
return a + b;
}
}
Output