From: balbao Date: 2009-08-07T16:40:11+09:00 Subject: Re: What is wrong with this program? Hey, There are couple of things to be mended in the function "findarea". They are (i) "area_of_segment=(4.0/3)*area_of_triangle" But in the prev line, you have declared the variable as "area_of_triange". "L(l) is missing." (ii) You're returning the variable "area" from the function to the main block. But there is no such variable in the function. Guess it has to be "area_of_segment". This should work now. - Balbao. On Aug 7, 9:06 am, pharrington wrote: > On Aug 6, 11:51 pm, Prateek Agarwal wrote: > > > I don't understand what is wrong with this program. It gives an error: > > 'findarea' undefined local variable or method 'area_of_triangle' > > Both 'findarea' and 'area_of_triangle' are clearly defined. > > > Attachments:http://www.ruby-forum.com/attachment/3933/Q3a1.rb > > > -- > > Posted viahttp://www.ruby-forum.com/. > > Prateek, > > You post alot of basic troubleshooting questions on the list. This > really is something you need to learn to do on your own when > programming, as no one gets their code right the first time through > the keyboard. > > But for this, a simple Ctrl+F through your own code will give you the > answer.