Use of .push and .to_sym


i do not understand properly
please explain what is it doing because output is same nothing is change here

strings = ["HTML", "CSS", "JavaScript", "Python", "Ruby"]
symbols = []

strings.each do |s| 
print symbols

[:HTML, :CSS, :JavaScript, :Python, :Ruby]


you convert strings to symbols, "html" (string) has become :HTML (symbol). same for all the other elements in the array

so there is certainly a change.


thanks for your help

now i understand


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