defmain() -> int
s: State = State()
s.angle = random.random_betweenf(30.0f, 45.0f)
s.width = 600.0f
s.height = 600.0f
s.frame_count = num.i2uu(0)
s.blue = rl.color(0, 255, 214, 255)
s.green = rl.color(0, 255, 0, 255)
s.color3 = rl.color(255, 45, 156, 255)
rl.init_window(num.f2i(s.width), num.f2i(s.height), "Fractal Tree in the Wind")
rl.set_target_fps(120)
seed: u64 = random.init_random() whilenot rl.window_should_close():
rl.begin_drawing()
update_draw_frame(s)
rl.draw_fps(0, 0)
rl.end_drawing()
s.frame_count = s.frame_count + num.i2uu(1)
random.set_seed(seed)
rl.close_window() del s return 0
An inefficient factorial calculation using recursion
Click to see code sample importlibs.console
deffactorial(x: int) ->
int: if x <= 0: return 1 return x * factorial(x - 1)
defmain() -> int
a: int = 0 while a < 10:
console.cyan("factorial")
console.red("(") print(a)
console.red(") = ") println(factorial(a))
a = a + 1 return 0
A 2-in-1 counter as a web application (WASM)
Click to see code sample importraylibasrl importraylib.utils importraylib.gui importlibs.numbersasnum