--- id: fn-some name: some category: builtins kind: builtin tokens: some sig: some(v) -> option tip: Wrap a present value in an option. order: 16 --- Wraps a present value in an option — the value type that models maybe a value without a magic -1 sentinel. An option is either some(value) (this) or none (empty); test it with is_some / is_none and read it with unwrap_or. The payload is any i32-width scalar — int, fixed, bool, or entity. Parameters: - `v` — the present value ```ludic program Targeting { function nearest(count: int) -> option { if count == 0 { return none() } return some(count - 1) # the nearest target index } test "some carries the value" { let t = unwrap_or(nearest(3), 0 - 1) expect_eq(t, 2) } } ```