ruby code
Ruby
code posted
created at 08 Oct 09:18, updated at 20 Oct 02:49
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
def something a = [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ], [ 9, 10,11,12 ], [ 13,14,15,16 ] ] puts a.inspect (0..3).each do |i| (0..3).each do |j| aux = a[i][j] a[i][j] = a[j][i] a[j][i] = aux end end puts a.inspect end something |
317 Bytes in 2 ms with coderay