loop a string ruby code example
Example 1: iterate over string ruby
a = 'hello, world'
a.each_char { |c|
puts c
}
Example 2: ruby iterate over strings
$ ruby examples/ruby/iterate_characters_split.rb
6
c
a
b
c
d
e
f
a = 'hello, world'
a.each_char { |c|
puts c
}
$ ruby examples/ruby/iterate_characters_split.rb
6
c
a
b
c
d
e
f