Skip to content

Instantly share code, notes, and snippets.

@ArslanKathia
Created February 3, 2023 10:12
Show Gist options
  • Save ArslanKathia/e65b24801d5f6ef84e055505da355eb4 to your computer and use it in GitHub Desktop.
Save ArslanKathia/e65b24801d5f6ef84e055505da355eb4 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=
//SPDX-License-Identifier: MIT
pragma solidity ^0.8;
contract Immutable{
//immutable state variable can be set inline - constructor
address public immutable owner;
//constant defined only inline
address public constant owner2 = address(1);
//simple state variable defined.
address public owner3 = address(2);
constructor(address _owner){
owner = _owner;
}
function IO() public view returns(address){
return owner;
}
function CO() public pure returns(address){
return owner2;
}
function PO() public view returns(address){
return owner3;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment