Skip to content

Conversation

@masteramyx
Copy link

No description provided.


def capitalize_each_string(input)
#implement your solution here
input.map {|x| x.capitalize}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a shorthand syntax when we just call one method on the block variable:

input.map(&:capitalize)

This means: call capitalize on each item in the array, without needing to name the element as we iterate through them ("x"). It's more "declarative" and generally preferred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants