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
pragma solidity >= 0.5.0 < 0.6.0; | |
// @author Andrej | |
// @title Election | |
contract Election { | |
address payable public contractOwner; | |
struct Candidate { | |
string name; |
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
pragma solidity ^0.6.0; | |
contract HotelRoom { | |
enum Statuses { Vacant, Occupied } | |
Statuses currentStatus; | |
event Occupy(address _occupant, uint _amount); | |
address payable public owner; |
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
pragma solidity ^0.6.0; | |
contract MyContract { | |
uint[] public numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; | |
address public owner; | |
constructor() public { | |
owner = msg.sender; |
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
pragma solidity ^0.6.0; | |
contract Mappings { | |
// Mappings are data structure like dictionary in C# or hash tables in C++ | |
// O(1) | |
// mapping(key => value) myMapping; | |
// One can make nested mappings as well | |
// Mappings are like databases for blockchain and they are very useful | |
mapping(uint => string) public names; |
NewerOlder