Ruby

Enumerators

Difficulty:
Basic
Basic
Intermediate
Advanced

each

Execute a code block for each element in an array

map

Construct a new array based on a one-to-one mapping from an initial array

select

Get the elements of an array that satisfy some condition

reject

Get the elements of an array except those that satisfy some condition

find

Find the first element in an array that satisfies some condition

none?

Determine whether no elements in an array satisfy some condition

all?

Determine whether all elements in an array satisfy some condition

any?

Determine whether any element in an array satisfies some condition

one?

Determine whether exactly one element in an array satisfies some condition

count

Determine how many elements in an array satsify some condition