Thursday, March 12, 2009

ruby nice puts




A really nice little trick in Ruby to do formatted output.


puts "%3.6f" % unscaled


You can also use sprintf:


a = sprintf("%3.3f %3.3f",curr.to_f/60.0,diff)