Last active
January 4, 2019 10:20
-
-
Save rmlopes/adb0f82e7db6540801e9683e494dc09c to your computer and use it in GitHub Desktop.
Simple storage function for Solidity v0.5, with modifier
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
pragma solidity ^0.5.0; | |
contract MyContract { | |
uint public mynumber; | |
/* Modified simple storage function. Only stores numbers greater than 10. */ | |
modifier checkValue(uint mynum){ | |
require(mynum > 10); | |
_; | |
} | |
constructor() public{ | |
mynumber = 24; | |
} | |
function storeNum(uint mynum) | |
public | |
checkValue(mynum) | |
{ | |
mynumber = mynum; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment