Builtins
The standard builtin functions available in every AHA! program
Builtins
Every AHA! program gets a small set of standard builtins:
| Builtin | Description |
|---|---|
print(int) | Print an integer |
print_str(string) | Print a string |
len(string) | String length in O(1) |
abs(x) | Absolute value |
min(a, b) | Smaller of two numbers |
max(a, b) | Larger of two numbers |
Examples
print(42); // 42
print_str("hello"); // hello
print(len("hello")); // 5
print(abs(-7)); // 7
print(min(3, 9)); // 3
print(max(3, 9)); // 9Notes
printtakes an integer;print_strtakes a string.print("hi")is a compile-time type error — strings go throughprint_str.lenreturns the stored length of the string struct, so it is O(1) regardless of string size.