From: Ken Bloom Date: 2006-12-20T00:10:12+09:00 Subject: Re: Division hangs irb On Tue, 19 Dec 2006 23:06:05 +0900, Vincent Fourmond wrote: > Ashley Moran wrote: >> Anyone know why the first three of these calculations works on my irb >> (on intel OS X 10.4.8), but the last one silently hangs? >> >>>> (DateTime.now - Date.new(2006,9,15)).to_f / 30 >> => 3.18572031018981 >>>> (DateTime.now - Date.new(2006,9,15)).to_f/ 30 >> => 3.18572102628549 >>>> (DateTime.now - Date.new(2006,9,15)).to_f/30 >> => 3.18572174544174 >>>> (DateTime.now - Date.new(2006,9,15)).to_f /30 > > Irb takes the latter as the beginning of a regular expression for the > first argument of to_f: ...therefore IRB is still waiting for input. But you should see the a prompt when you hit enter, with a different ending character (/ instead of >) to indicate that IRB is still waiting for input. >>> (DateTime.now - Date.new(2006,9,15)).to_f /30 > / > ArgumentError: wrong number of arguments (1 for 0) > from (irb):10:in `to_f' > from (irb):10 > from /usr/lib/ruby/1.8/rational.rb:520 > > Cheers, > > Vince -- Ken Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/