Files

23 lines
525 B
Plaintext
Raw Permalink Normal View History

2026-10-26 10:14:11 -05:00
import std::io;
import shapes;
def main(): void {
var b := parcel{ n = 5 };
println($"{b.count} {b.twice} {b.label}");
b.label = 8;
b.bump();
println($"{b.count} {b.twice} {b.label}");
}
module shapes;
pub struct parcel { pub var n: i64; }
var parcel::count: i64 {
pub get => this.n;
set => this.n = value;
}
var parcel::twice: i64 {
pub get => this.n * 2;
}
pub var parcel::label: i64 {
get => this.n + 100;
set => this.n = value;
}
pub def parcel::bump(&mut this): void { this.count = this.count + 1; }