1
0
Fork 0
forked from koniifer/ableos
ableos-framebuffer/hblang/examples/struct_operators.hb

22 lines
259 B
Plaintext
Raw Normal View History

2024-05-14 05:17:39 -05:00
Point := struct {
x: int,
y: int,
}
Rect := struct {
a: Point,
b: Point,
}
main := fn(): int {
a := Point.(1, 2);
b := Point.(3, 4);
d := Rect.(a + b, b - a);
d2 := Rect.(Point.(0, 0) - b, a);
d2 = d2 + d;
c := d2.a + d2.b;
return c.x + c.y;
}