| 1 |
pub contract HelloWorld { |
| 2 |
|
| 3 |
// Declare a public field of type String. |
| 4 |
// |
| 5 |
// All fields must be initialized in the init() function. |
| 6 |
pub let greeting: String |
| 7 |
|
| 8 |
// The init() function is required if the contract contains any fields. |
| 9 |
init() { |
| 10 |
self.greeting = "Hello, World!" |
| 11 |
} |
| 12 |
|
| 13 |
// Public function that returns our friendly greeting! |
| 14 |
pub fun hello(): String { |
| 15 |
return self.greeting |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
// From https://docs.onflow.org/cadence/tutorial/02-hello-world/ |