13. lambda syntax


#1

I need HELP!

I can't make out why it doesn't work...whether I use .intern or .to_sym, I've got the following message "undefined method intern!' /to_sym!' for "leonardo":String".

Can you see what I am doing wrong?

Thanks for your feedback

==============================
strings = ["leonardo", "donatello", "raphael", "michaelangelo"]

Write your code below this line!

symbolize = lambda { |x| x.intern! }

Write your code above this line!

symbols = strings.collect(&symbolize)


13. Lambda Syntax
#2

Those methods don't exist and don't make sense. Strings can't become symbols, but you can create a symbol based on the data in the string (the original value stays the same)
Refer to how you created symbols before, or documentation (google for ruby and the thing you want to do). You may also want to read about ruby's bang methods


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.