On Feb 4, 10:18 pm, Karl von Laudermann <doodpa... / mailinator.com>
wrote:
> On Feb 4, 4:01 pm, "gr... / spray.se" <gr... / spray.se> wrote:
>
> > Hi,
>
> > While debugging some ruby-code, I found a mis-typed construct like the
> > following,
> > which looks like a syntax error to me,
> > but when you run it in irb it evaluates to nil and does NOT raise an
> > error:
>
> > x = def
> >  puts xyz
> > end
>
> > (where xyz is undefined)
> > Anyone can explain what the above code means to ruby?
>
> I believe that it is being interpreted as defining an empty method
> like so:
>
> def puts(xyz)
> end
>
> and assigning to x the result of the call to "def".


Thanks for help guys.
Yes, makes sense.

/grz01