Title / Description
Code def print_array(file, arr) arr.each do |i| file.write i file.write "\t" end end code = ['0','1'] n = 7 file = File.open('text.txt', 'w') print_array(file, code) file.write "\n" (n-1).times do old = code new = code.reverse old.map! {|i| '0' + i} new.map! {|i| '1' + i} code = old + new print_array(file, code) file.write "\n" end file.close #print_array(code)
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code