From: Phrogz Date: 2007-06-19T02:40:14+09:00 Subject: Re: one-line function definitions On 6/18/07, Mike Steiner wrote: > I'm converting some code from Python to Ruby and can't figure out the syntax > for one-line function definitions in Ruby. For example, what would this line > be in Ruby? > > def GetAnthologyTitle ( data , prefix ): return GetField ( data , prefix , > 'ANTHOLOGY-TITLE' ) def foo(x) x*x end def bar(x) x-102 end def jim(x) y=foo(x); bar(y) end p jim(12) #=> 42