Check out example codes for "iterate over string ruby". It will help you in understanding the concepts better.

Code Example 1

a = 'hello, world'
a.each_char { |c|
  puts c
}

Learn ReactJs, React Native from akashmittal.com