Skip to content

Commit 3a1ad80

Browse files
Add files via upload
1 parent 5057097 commit 3a1ad80

File tree

1 file changed

+14
-0
lines changed
  • motoko/hello_world/backend

1 file changed

+14
-0
lines changed

motoko/hello_world/backend/app.mo

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
actor HelloWorld {
2+
// We store the greeting in a stable variable such that it gets persisted over canister upgrades.
3+
stable var greeting : Text = "Hello, ";
4+
5+
// This update method stores the greeting prefix in stable memory.
6+
public func setGreeting(prefix : Text) : async () {
7+
greeting := prefix;
8+
};
9+
10+
// This query method returns the currently persisted greeting with the given name.
11+
public query func greet(name : Text) : async Text {
12+
return greeting # name # "!";
13+
};
14+
};

0 commit comments

Comments
 (0)