53b43b0f79
Ship the QUALITY_PLAN stretch from ownership through ecosystem: C.1 lifetime elision (bootstrap + selfhost), bux fmt/test/doc CI hooks, stdlib goldens, package registry (bux search/add), and LSP 0.4 position-sensitive locals with inferred let types. Full-tree format pass plus Map/Set remove double-free fix.
30 lines
566 B
Plaintext
30 lines
566 B
Plaintext
// Structs - Basic struct usage
|
|
import Std::Io::{PrintLine, PrintInt};
|
|
|
|
|
|
struct Point {
|
|
x: int;
|
|
y: int;
|
|
}
|
|
|
|
func AddPoints(a: Point, b: Point) -> Point {
|
|
let result: Point = Point { x: a.x + b.x, y: a.y + b.y };
|
|
return result;
|
|
}
|
|
|
|
func Main() -> int {
|
|
let p1: Point = Point { x: 10, y: 20 };
|
|
let p2: Point = Point { x: 5, y: 15 };
|
|
let sum: Point = AddPoints(p1, p2);
|
|
|
|
PrintLine("Point sum:");
|
|
PrintLine("x = ");
|
|
PrintInt(sum.x);
|
|
PrintLine("");
|
|
PrintLine("y = ");
|
|
PrintInt(sum.y);
|
|
PrintLine("");
|
|
|
|
return 0;
|
|
}
|