pegli (1) [Avatar] Offline
#1
When I looked at this line of code:

def result = ''<<''  // Empty StringBuffer


I somehow got it into my head that it was a leftshift operator enclosed in two pairs of single quotes rather than "empty string" leftshift "empty string", probably because I'm used to seeing 1x single quote and 3x single quote as string delimiters. I pored over the Groovy docs to try to find what this cool new 2x single quote delimiter does, but there were no references to it... smilie

It might be helpful in future editions to add spacing between the quotes and the leftshift so line 2 looks more like line 3:

def result = '' << ''

def indent = ' ' * 4


or just new up a StringBuffer so the intent is totally explicit.

Thanks for a great book!

p.