我跟上的用例感到困惑Enumerable#all?和Enumerable#each.例如
['.txt', '-hello.txt'].all? do |suffix|
puts "temp#{suffix}"
end
Run Code Online (Sandbox Code Playgroud)
适合我和我
['.txt', '-hello.txt'].each do |suffix|
puts "temp#{suffix}"
end
Run Code Online (Sandbox Code Playgroud)
也适合我.
我应该选择什么样的.all?还是.each?
| 归档时间: |
|
| 查看次数: |
83 次 |
| 最近记录: |