Skip to content

Instantly share code, notes, and snippets.

@Davidegloh
Created August 14, 2021 18:26
Show Gist options
  • Save Davidegloh/795ed5b21148993a2fa52a2587c4a33d to your computer and use it in GitHub Desktop.
Save Davidegloh/795ed5b21148993a2fa52a2587c4a33d to your computer and use it in GitHub Desktop.
[ControlFlow-Solidity]#controlFlow
//Control Flow (if, else)
pragma solidity 0.7.5;
contract HelloWorld {
// state variables
string message ; // message will have the value of _message
constructor(string memory _message){
message = _message;
}
function hello() public view returns(string memory){
if (msg.sender == 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4){
return message;
} else {
return "wrong address";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment