fork(2) download
  1. values = [ "a", "b", "c", "a", "d" ]
  2.  
  3. p values.each_index.select {|i| values[i] == 'a'}
  4. p values.size.times.select {|i| values[i] == 'a'}
Success #stdin #stdout 0.02s 9656KB
stdin
Standard input is empty
stdout
[0, 3]
[0, 3]