A.Enum.all-question-mark
You're seeing just the function
all-question-mark
, go back to A.Enum module for more information.
Specs
all?(t(as_boolean(val))) :: boolean() when val: value()
Returns true
if all elements in enumerable
are truthy.
When an element has a falsy value (false
or nil
) iteration stops immediately
and false
is returned. In all other cases true
is returned.
Examples
iex> A.Enum.all?([1, 2, 3])
true
iex> A.Enum.all?([1, nil, 3])
false
iex> A.Enum.all?([])
true
Specs
all?(t(val), (val -> as_boolean(term()))) :: boolean() when val: value()
Returns true
if fun.(element)
is truthy for all elements in enumerable
.
Iterates over enumerable
and invokes fun
on each element. If fun
ever
returns a falsy value (false
or nil
), iteration stops immediately and
false
is returned. Otherwise, true
is returned.
Examples
iex> A.Enum.all?([2, 4, 6], fn x -> rem(x, 2) == 0 end)
true
iex> A.Enum.all?([2, 3, 4], fn x -> rem(x, 2) == 0 end)
false
iex> A.Enum.all?([], fn _ -> nil end)
true