Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Use gets.chomp.split() to convert a string to an array e.g: puts gets.chomp.split() # Split at space as default puts gets.chomp.split(',') # Split at , (chomp to deal with newlines after input, but not needed when using space as the delimiter)
22nd Aug 2017, 10:01 PM
Dennis
Dennis - avatar