From: Brian Candler Date: 2003-07-19T05:25:14+09:00 Subject: Re: [SNIPPET] Binary counter On Sat, Jul 19, 2003 at 04:36:23AM +0900, Mauricio Fern?ndez wrote: > >> 8.times {|i| 4.times {|j| print i[3-j]}; puts } > 0000 > 0001 > 0010 > 0011 > 0100 > 0101 > 0110 > 0111 > => 8 And also: irb(main):003:0> 8.times { |i| puts "%04b" % i } 0000 0001 0010 0011 0100 0101 0110 0111 => 8