You need to enable JavaScript to run this app.
Ruby
Enumerators
Difficulty:
Basic
Basic
Intermediate
Advanced
each
Execute a code block for each element in an array
Usage
Details
Example
map
Construct a new array based on a one-to-one mapping from an initial array
Usage
Details
Example
select
Get the elements of an array that satisfy some condition
Usage
Details
Example
reject
Get the elements of an array except those that satisfy some condition
Usage
Details
Example
find
Find the first element in an array that satisfies some condition
Usage
Details
Example
none?
Determine whether no elements in an array satisfy some condition
Usage
Details
Example
all?
Determine whether all elements in an array satisfy some condition
Usage
Details
Example
any?
Determine whether any element in an array satisfies some condition
Usage
Details
Example
one?
Determine whether exactly one element in an array satisfies some condition
Usage
Details
Example
count
Determine how many elements in an array satsify some condition
Usage
Details
Example