Files
rexlang/examples/04_types.rex
T
Your NameandClaude Opus 5.5 7cf9727bcd Rename the language from Dino to Rex
Files use .rex, the command is rex, and the crate, runtime prefixes,
docs, editor files and examples all use the new name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 13:51:23 +01:00

24 lines
408 B
Rexx

// Enums with data, generics, interfaces.
enum Shape {
Circle(r: f64)
Rect(w, h: f64)
}
func area(s: Shape): f64 {
return match s {
Circle(r) => 3.14159 * r * r
Rect(w, h) => w * h
}
}
interface Drawable { draw() }
func draw_all[T: Drawable](items: []T) {
for item in items { item.draw() }
}
func max[T: Ordered](a, b: T): T {
if a > b { return a }
return b
}