Permalink
Browse files

More idiomatic ruby

  • Loading branch information...
1 parent c03028f commit 4b430d5caa98f48437de38c0bc9370fa22428959 @bookwyrm committed Apr 7, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 ruby/day_2_1.rb
View
@@ -1,6 +1,6 @@
a = []
i = -1
-(1..16).each { |n| n % 4 == 1 ? a[i=i+1] = [n] : a[i].push(n) }
+(1..16).each { |n| n % 4 == 1 ? a[i=i+1] = [n] : a[i] << (n) }
p a
(1..16).each_slice(4) { |a| p a }

0 comments on commit 4b430d5

Please sign in to comment.