Version: v0.8.1 - Beta.  We welcome contributors & feedback.

List.default

default($value) -> self

Description

Set a default value for missing items.

$nums = [10, 20, 30].default(0)

$nums[1] //= 10
$nums[9] //= 0 (default)

See Also