Created
January 30, 2023 12:07
-
-
Save ArslanKathia/8ab33309330b56fb1a25813e6d59313d to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: MIT | |
pragma solidity ^0.8; | |
contract Require{ | |
address public owner = msg.sender; | |
uint public age = 25; | |
//when require condition is false than execution stopped and previously set the state variable goes to reset state | |
// and refund the gas fee. | |
function CheckAge(uint _x) public{ | |
age = age + 5; | |
require(_x>2,"X values is less than 2"); | |
} | |
//when require condition is false than execution stopped and previously set the state variable goes to reset state | |
// and refund the gas fee. | |
function onlyOwner() public{ | |
require(owner == msg.sender,"You are not the owner"); | |
age = age +2 ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment