From: William Colls Date: 2010-12-28T06:37:29+09:00 Subject: Where is the extar end keyword. ruby 1.9.1p378 (2010-01-10 revision 26273) [x86_64-linux] Kubuntu 10.04 64 Bit. I know this is REALLY basic stuff, but has me stumped. The following is an example from the Pick Axe book (Seventh printing Dec 2005): require 'tk' class PigBox def pig(word) leading_cap = word =~ /^[A-Z]/ word.downcase! res = case word when /^[aeiouy]/ word+"way" when /^([aeiouy]+)(.*)/ $2+$1+"ay" else word end # else condition of case leading_cap ? res.capitalize : res end. # method pig def show_pig @text.value = @text.value.split.collect{ |w| pig(w) }.join(" ") end # method show_pig def initialize ph = { 'padx' => 10, 'pady' => 10 } # Common Options root = TkRoot.new { title "Pig" } top = TkFrame.new(root) { background "white" } TkLabel.new(top) { text 'Enter Text:' ; pack(ph) } @text = TkVariable.new TkEntry.new(top, 'textvariable' => @text).pack(ph) pig_b = TkButton.new(top) { text 'Pig It' ; pack ph } pig_b.command { show_pig } exit_b = TkButton.new(top) {text 'Exit'; pack ph} exit_b.command { exit } top.pack('fill' =>'both', 'side' =>'top' ) end # method initialize end # Class PigBox PigBox.new Tk.mainloop When I run it, I get an error as follows: Ex2.rb:38: syntax error, unexpected keyword_end, expecting $end end # Class PigBox I Understand that the error message is telling me that I have an extra end keyword. The interpretor expected the end of File. But I can't determine which is extra "end". Comparing line by line with text in the book, it appears identical. Downloading the source from the web site, and it runs as expected, and again, line by line comparison seems to be identical. So what have I miss-typed? Thanks for your time. -- Posted via http://www.ruby-forum.com/.