Elektrine lite

← Feed

@pranabekka@mastodon.social

Post #2896109

2026-05-24 12:42 UTC

``` // ranged.gleam pub opaque type Ranged { Ranged(value: Int, min: Int, max: Int } pub fn new(value, min, max) -> { Ranged( value: int.clamp(value, min:, max:), min:, max:, ) } pub fn set(current: Ranged, to new: Int) -> Ranged { Ranged( value: int.clamp( new, current.min, current.max, ), min: current.min, max: current.max, ) } ``` 1 of 2 #gleam #gamedev #functionalprogramming edit: noo, my indentation :(

Replies (0)

No replies.