Log in from a computer to take this course

You'll need to log in from a computer to start Learn Ruby. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store

Lambdas are defined using the following syntax:

lambda { |param| block }

Lambdas are useful in the same situations in which you’d use a proc. We’ll cover the differences between lambdas and procs in the next exercise; in the meantime, let’s get a little practice in with the lambda syntax.



We have an array of strings in the editor, but we want an array of symbols.

On line 4, create a new variable called symbolize. In symbolize, store a lambda that takes one parameter and calls .to_sym on that parameter.

We then use symbolize with the .collect method to convert the items in strings to symbols!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?