Files
dimgigov 92c5cd59f5 refactor: migrate examples to import Std::Io instead of raw extern func
- Create stdlib/Std/Io.bux with extern func declarations
- Rename C shim functions to short names (PrintLine, PrintInt, etc.)
- Update all 9 examples to use import Std::Io::{PrintLine, PrintInt};
- Remove manual extern func Std_Io_* declarations from examples
2026-05-31 02:01:28 +03:00

30 lines
574 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;
}