Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
#!/usr/bin/env ruby # Dustin McCormick <djmccormick@bsu.edu> # Ruby 1.8.5 <http://www.ruby-lang.org/> (platform independent) # CS 124, Fall 2006 puts "Please enter the requested information about the two matrices you wish to multiply:" counter = 0 4.times do counter += 1 rows_or_columns = counter % 2 != 0 ? 'rows' : 'columns' first_or_second = counter < 3 ? 'first' : 'second' print "Please enter the #{rows_or_columns} in the #{first_or_second} matrix: " input = gets.chomp.to_i @dimensions << {first_or_second => {rows_or_columns => input}} puts puts if counter == 2 || counter == 4 end puts @dimensions.to_s
From the Design Piracy series on my blog: