-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelloWorld.sol
More file actions
28 lines (23 loc) · 890 Bytes
/
HelloWorld.sol
File metadata and controls
28 lines (23 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
pragma solidity ^0.4.2;
// In computer programming, a directive pragma (from "pragmatic")
// is a language construct that specifies how a compiler
// (or assembler or interpreter) should process its input.
contract HelloWorld{
// variable to store greeting text
string public greeting;
uint public numberOfChanges = 0;
// This is the constructor whose code is
// run only when the contract is created.
// Recommended practice is to make constructors
// without constructor parameters
function HelloWorld(string _greeting){
greeting = _greeting;
} // end of constructor
event GreetingChanged(string NewGreetingText, uint NewGreetingNumber);
//
function changeGreeting(string _greeting){
greeting = _greeting;
numberOfChanges++;
GreetingChanged(_greeting, numberOfChanges);
} // end of changeGreeting
}