我想知道是否可以从放置在传递给 Each 的块中的 for 循环中返回到 Ruby 中的 Each 迭代器。
def find member = ""
productHash = {}
#@entries is a hash, with both the keys and values being strings
#the member parameter is a string
@entries.each do |key, value|
for i in 0...member.size
if(key[i] != member[i])
next #the next keyword doesn't work...all it does is return to the for iterator. I'm looking for a keyword that would return to the each iterator, and allow each to pass back in the next key-value pair.
end
end
productHash[key] = value
end
productHash
end
我想要完成的是:当我看到成员参数中的字符与给定键中的相应字符不匹配时,我将继续进行下一个键值对。