Section 1

Preview this deck

collection.map method is for?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (25)

Section 1

(25 cards)

collection.map method is for?

Front

Transformation, not selection.

Back

hash.each do |key, value| puts "#{key} and its #{value}" end

Front

Iterating over a hash

Back

Which is the block part of this method: array.each do |num| puts num end

Front

The method "each" takes a block "do |num| puts num end

Back

Why use array.fetch(3) instead of array[3]

Front

array.fetch will give a error if selected index is out of range.

Back

hash.values

Front

Returns all hash values in a array

Back

Four loop basics all loops must have

Front

1. Loop 2. Counter 3. Retrieval of current value 4. Exit

Back

Turn a array into a string?

Front

array.join

Back

Definition of "selection"

Front

Selecting a specific number of elements from a collection based on a condition

Back

.map and .collect perform actions based on the ________ value of the block.

Front

Return

Back

<=> What is this?

Front

"Spaceship operator"

Back

Accessing hash value at key :x ?

Front

hash[:x]

Back

Using .each do on a hash requires ____ arguments? What kind of arguments? ___ _____

Front

Two arguments. Key and Value

Back

.each method is the same as a basic _____

Front

loop do method

Back

What does "string".chars do?

Front

["s","t","r","i","n","g"]

Back

hash.keys

Front

Returns all hash keys in a array

Back

Definition of "transformation"

Front

Selecting all elements from a collection.

Back

A "safe" way to retrieve a array[index]

Front

array.fetch(index)

Back

String element assignment syntex

Front

string[index] = "X"

Back

Deleting key value pairs with a condition

Front

hash.delete_if |k, v| do v < x end

Back

A "safe" way to retrieve a hash[key]

Front

hash.fetch(key)

Back

What is the difference between: array[3] and array[3..3]

Front

array[3] returns just the element. array[3..3] returns the same element but in a array.

Back

Adding a key value pair to a hash?

Front

hash[key] = value

Back

hash.to_a

Front

Returns a array of your hash. Does not change hash.

Back

hash.select {|k, v| k == keyinhash}

Front

Returns selected values determined by code block.

Back

hash.has_key?(key)

Front

Does the hash have a specific key. Returns boolean answer.

Back