Files
highground-fork/tests/struct.sols

23 lines
336 B
Plaintext
Raw Normal View History

2026-04-11 17:05:20 +10:00
struct Person {
name = ""
age = 0
def greet() string {
return "Hello, " + self.name + "!"
}
2026-04-11 17:05:20 +10:00
constructor(string name, int age) {
self.name = name
self.age = age
}
2026-04-11 20:42:14 +10:00
destructor {
// We don't need to do anything here.
}
2026-01-25 17:40:07 +11:00
}
2026-04-11 17:05:20 +10:00
max = Person("Max", 16)
2026-04-11 20:42:14 +10:00
2026-04-11 17:05:20 +10:00
puts max
2026-04-11 20:42:14 +10:00
puts max.greet()