Version: v0.6.0 - Beta.  We welcome contributors & feedback.  THanks!

List.default

default($value)

Description

Set a default value for missing elements.

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

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