From: Wes Gamble Date: 2006-03-22T08:22:46+09:00 Subject: Re: Newbie: Printing hex formatted string using printf If I do puts "Magic number is: #{magic_number.to_s(16)}" I get wrong number of arguments (1 for 0) wg Matthew Moss wrote: >> Why does printf act like a private method here? > > printf is not a method on Fixnum. The error is confusing (except that > the first word is "NoMethodError"). > > If you want to use printf, just do: > > $stderr.printf "Magic number is: %X\n", magic_number > > Or, more ruby-ish: > > puts "Magic number is: #{magic_number.to_s(16)}" -- Posted via http://www.ruby-forum.com/.