arr = ['x', 'o', 'x', '.', '.', 'o', 'x']p arr.each_index.select{|i| arr[i] == 'x'}
Standard input is empty
[0, 2, 6]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!