From: Stefano Crocco Date: 2012-01-23T03:05:06+09:00 Subject: Re: codepart - please explain! Il giorno Mon, 23 Jan 2012 02:54:17 +0900 Blub Bla ha scritto: > Hey everyone, > > I've found a code part that I don't understand: > > > > def runCode > return < (..) > STARTCODE > end > > > Unfortunately the google search doesn't work because the << will be > ignored. > Could you explain what it's doing? > > Oh, and I can't try out what it's doing because I'll get the error that > STARTCODE can't be found until EOF... > > Thx > It's another form of string literal, just as ' ' or " ". The string content start from the line after STARTCODE and continues until a line starting with STARTCODE is found. Note that the line must truly start with STARTCODE, it can't have any leading whitespace (this is the reason you get an error). If you want to have whitespace before the closing STARTCODE, you must put a - after the <<: return <<-STARTCODE Note that the delimiting string doesn't need to be STARTCODE, it can be anything you like, as long as you use the same string at the beginning and end of the string. I hope this helps Stefano