Skip to content

Instantly share code, notes, and snippets.

@kangkyu
Last active August 29, 2015 14:27
Show Gist options
  • Save kangkyu/c955f2673111f26d5e46 to your computer and use it in GitHub Desktop.
Save kangkyu/c955f2673111f26d5e46 to your computer and use it in GitHub Desktop.
# Write a program that processes the string s = "Welcome to the forum.\nHere you can learn Ruby.\nAlong with other members.\n" a line at a time, using all that we have learned so far.
s = "Welcome to the forum.\nHere you can learn Ruby.\nAlong with other members.\n"
s.each_line.with_index 1 do |line, line_num|
puts "Line #{line_num}: #{line}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment