Initial Commit
This commit is contained in:
789 files changed
+149185
No files matched your search
@@ -0,0 +1,23 @@
|
||||
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; }
|
||||
Reference in new issue
Block a user