I’m sure this is really easy but I’m having trouble working out how to
complete a Ruby tutorial converting strings to symbols.
The idea here is to convert the strings array to symbols using .to_sym
and to push them into a symbols array. They are not converting though.
Can someone please point me in the right direction?
The idea here is to convert the strings array to symbols using .to_sym
and to push them into a symbols array. They are not converting though.
Can someone please point me in the right direction?
You’ve got the right idea, what you haven’t done is “push them into a
symbols array”.
The to_sym method converts a string into a symbol and returns it, but it
does not modify the string itself. Currently your language variable
still points to a string and the symbol is returned to nowhere.