str = "level"str.each_char do |c| puts cend# 带索引迭代for i in 0...str.length puts "str[#{i}] = \"#{str[i].chr}\""end