This file contains 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: GPL-3.0 | |
pragma solidity >=0.5.0 <0.9.0; | |
// code for view type function | |
contract sample { | |
uint s = 10; | |
function f_name(uint _a) public view returns (uint) { | |
return _a + block.number; | |
} |
This file contains 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.0; | |
contract bitwise_operator { | |
bytes1 x = 0x16; // bit representation: 00010110 | |
bytes1 y = 0x11; // bit representation: 00010001 | |
// Bitwise 'AND' | |
bytes1 byte_and = x & y; // 00010110 & 00010001 -> 00010000 -> in byte (0x10) |
This file contains 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.0; | |
contract comparison_operator { | |
uint x = 10; | |
uint y = 12; | |
int z = 10; | |
// Less than | |
bool res = x < y; // res = true |
This file contains 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: UNLICENSED | |
pragma solidity ^0.8.0; | |
uint constant T = 10; | |
contract Logical_Operation { | |
uint x = 10; | |
uint y = 20; |
This file contains 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: UNLICENSED | |
pragma solidity ^0.8.0; | |
uint constant T = 10; | |
contract Arithmetic_Operation { | |
uint x = 10; | |
uint y = 20; |
This file contains 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-License | |
pragma solidity ^0.8.0; | |
contract first_sample { | |
} |
NewerOlder