From: Brian Candler Date: 2009-07-26T08:24:08+09:00 Subject: Re: Please debug this program Prateek Agarwal wrote: > I had to make a program to estimate the value of pi using Ramanujan's > method. > > I have made the program but it is giving the following error > > Question1.rb:8:in 'factorial':Interrupt You pressed ctrl-C? I'm surprised it even ran at all: def factorial(x) if (x==0) then return (1) end else ... something else This doesn't make sense syntactically - an 'else' without an 'if'. You need: if x == 0 return 1 else ... something else end -- Posted via http://www.ruby-forum.com/.