From: Mark Slagell Date: 2001-05-24T10:20:10+09:00 Subject: [ruby-talk:15636] Re: help attr_reader Stefan Matthias Aust spake: > > Mark Slagell wrote: > > >> def x(x) @x = x end > > >Well -- I'm sure it was a typo, but the writer would be x=(x), not > >x(x). And of course if you wanted to write them out on one line you'd > >need semicolons. > > > > def x=(x); @x=x; end > > Yes, that was a typo - thanks - and no, you don't need to add > semicolons. Ruby is clever enough to know that a new expressions > starts behind the parameter () and before end, you never need a > semicolon. > Ah. Something like "def x @x end" gave me a parse error once, so I thought delimiters were necessary there. Hadn't thought to put empty parens in. Good trick. :-) -- Mark