so... jai :D

This commit is contained in:
agra
2026-02-04 01:34:30 +02:00
commit 55fc5790e4
60 changed files with 15876 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
#import "modules/std.sx";
Point :: struct {
x: s32;
y: s32;
}
// Print all arguments — accepts any type, dispatches via type-switch
print_any :: (args: ..Any) {
for args {
type := type_of(it);
if type == {
case int: write(int_to_string(cast(s32) it));
case string: write(cast(string) it);
case bool: write(bool_to_string(cast(bool) it));
case float: write(float_to_string(cast(f64) it));
case Point: {
p := cast(Point) it;
write("(");
write(int_to_string(p.x));
write(",");
write(int_to_string(p.y));
write(")");
}
}
write(" ");
}
write("\n");
}
count :: (args: ..Any) -> s32 {
args.len;
}
main :: () -> s32 {
print_any(42, "hello", true, 3.14);
// Test with struct
p := Point.{ x=10, y=20 };
print_any("point:", p, 99);
// Test count
write(int_to_string(count(1, 2, 3)));
write("\n");
0;
}