-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathGreeterV6.sol
39 lines (29 loc) · 1.04 KB
/
GreeterV6.sol
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
29
30
31
32
33
34
35
36
37
38
39
pragma solidity ^0.4.18;
contract GreeterV6 {
struct Greeting {
string hello;
string goodbye;
}
mapping (string => Greeting) countryToGreeting;
function GreeterV3() public {
countryToGreeting[""] = Greeting("Hello","Goodbye");
Greeting memory korean = Greeting({goodbye:"",hello:""});
countryToGreeting["Korea"] = korean;
Greeting memory usa;
usa.hello = "Hi";
usa.goodbye = "Bye";
countryToGreeting["USA"] = usa;
}
function sayHello(string country) external view returns (string) {
return countryToGreeting[country].hello;
}
function changeHello(string country,string hello) external {
countryToGreeting[country].hello = hello;
}
function sayGoodbye(string country) external view returns (string) {
return countryToGreeting[country].goodbye;
}
function changeGoodbye(string country,string goodbye) external {
countryToGreeting[country].goodbye = goodbye;
}
}