Solidity explanation part II
Lets create a contract.contract Helloworld { string hello = “Hello World”; function sayHello() returns (string) { return hello; } } The code of contract goes between curly braces. The name HelloWorld is the name of our contract. It’s not necessary that the name has to be name given to the file. The keyword contract here can be treated similar to a class in C++/java. Where class has methods and variables so are here. Let’s see. The string variable is like a normal OOP string variable nothing f...
Solidity explanation part II
Lets create a contract.contract Helloworld { string hello = “Hello World”; function sayHello() returns (string) { return hello; } } The code of contract goes between curly braces. The name HelloWorld is the name of our contract. It’s not necessary that the name has to be name given to the file. The keyword contract here can be treated similar to a class in C++/java. Where class has methods and variables so are here. Let’s see. The string variable is like a normal OOP string variable nothing f...
Solidity explanation part I
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Primitives { bool public boo = true; /* uint stands for unsigned integer, meaning non negative integers different sizes are available uint8 ranges from 0 to 2 ** 8 - 1 uint16 ranges from 0 to 2 ** 16 - 1 ... uint256 ranges from 0 to 2 ** 256 - 1 */ uint8 public u8 = 1; uint public u256 = 456; uint public u = 123; // uint is an alias for uint256 /* Negative numbers are allowed for int types. Like uint, different ranges are avail...
Solidity explanation part I
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Primitives { bool public boo = true; /* uint stands for unsigned integer, meaning non negative integers different sizes are available uint8 ranges from 0 to 2 ** 8 - 1 uint16 ranges from 0 to 2 ** 16 - 1 ... uint256 ranges from 0 to 2 ** 256 - 1 */ uint8 public u8 = 1; uint public u256 = 456; uint public u = 123; // uint is an alias for uint256 /* Negative numbers are allowed for int types. Like uint, different ranges are avail...