Skip to content

Instantly share code, notes, and snippets.

View raj-pranav's full-sized avatar
🏠
Blockchain- ETH

Pranav Raj raj-pranav

🏠
Blockchain- ETH
View GitHub Profile
@raj-pranav
raj-pranav / Function-in-solidity.sol
Created January 29, 2022 20:53
Functions in Solidity
// 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;
}
@raj-pranav
raj-pranav / Bitwise_operators.sol
Created January 26, 2022 18:35
Operators in Solidity
// 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)
@raj-pranav
raj-pranav / Comparison_operator.sol
Created January 26, 2022 13:33
Operators in Solidity
// 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
@raj-pranav
raj-pranav / Logical_operators.sol
Created January 25, 2022 20:15
Operators in Solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
uint constant T = 10;
contract Logical_Operation {
uint x = 10;
uint y = 20;
@raj-pranav
raj-pranav / Arithmetic_operators.sol
Created January 25, 2022 19:36
Operators in Solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
uint constant T = 10;
contract Arithmetic_Operation {
uint x = 10;
uint y = 20;
@raj-pranav
raj-pranav / 1_first_contract.sol
Last active January 15, 2022 17:56
Learn solidity from the basics
// SPDX-License-Identifier: MIT-License
pragma solidity ^0.8.0;
contract first_sample {
}