Giving general verdict (true or false) from function execution on a list

Return true if all function returns are true.
If there is at least one false returns false.

Similar to And function but gives the opportunity to execute an additional function

Val1 And Val2 And Val3 ...

Returns true when:

(true And true And true And true) = true

Returns false when:

(true And false And true And true) = false

Erlang code:

Verdicts = [true, true, false, true].
Verdict = lists:all(fun(Elem)->Elem end, Verdicts).



returns the element of a list

More complex example:
We have a list with tuples:

{day_of_week_atom, Temeprature_value}

and we want to check if it was a warm week (temperature above 20 degrees of Celsius)

List = [{monday,21},{tuesday,22},{wednesday,6},{thursday,22},{friday,21}].
	lists:all(fun({_,Temperature})-> Temperature >= 20 end, List).

Function is executed on each element of a list until first false is returned.
So for above example it will be executed for Monday, Tuesday and Wednesday