On Sep 15, 2006, at 11:00 AM, Dave Rose wrote:

> i'm writing a method within the Akill class that cascades down 2 sql
> stmts inside some if and when stmts....but i get this when i added the
> last branch of if stmts: what happened note : ALL 'end' stmts are
> properly matched
>>> class Akill
>>>    def getusd(prem,cust,serv,scat,readit)
>>>          cursor=@@conn.exec("<<a working sql stmt here>>>")
>>>          k=Array.new
>>>     while r=cursor.fetch() and k.size<3
>>>          k.push(r)
>>>     end
>>>       cursor.close
>>>       if k.size>0
>>>        k.first
>>>       else
> ?>          cursor=@@conn.exec("<<a working sql stmt here>>>")
>>>          k=Array.new
>>>           while r=cursor.fetch() and k.size<3
>>>             k.push(r)
>>>           end
>>>          cursor.close
>>>              if k.size>0
>>>                 k.first
>>>      else
> ?>             #get defaults of kwd=0,kvar=700,kwh=1500
> ?>             #else nil
> ?>                  case scat
>>>                  when scat=='KWH' 1500
>>>
> Display all 459 possibilities? (y or n)

I can't even tell what you are trying to do / write. It looks like  
"freak out" in your world means "respond with everything when I hit  
tab in a place without context" which is exactly what it should do.  
If not, I suggest turning off tab completion first and trying again.

But beyond that, I still can't tell what you are trying to write. If  
it is something like:

case scat
when scat == 'KWH' 1500
scat=='KVAR' 700
scat=='KWD' 0
end

then yup. You're going to get a syntax error as you did in your email  
and that has nothing to do with IRB. Try it just using ruby -c -e  
'...code...' for example to see. GIGO. See http://www.zenspider.com/ 
Languages/Ruby/QuickRef.html#23 for examples of how to write properly  
formed case statements.