Format code with line numbers in Markdown notation
C:\>type Format.groovy | groovy Format 1: def counter = 1 2: 3: System.in.eachLine { 4: line -> 5: 6: def result = " " 7: (2 - ("" + counter).length()).times { result += " " } 8: result += "${counter}: ${line}" 9: println result 10: counter++ 11: } C:\>
def counter = 1 System.in.eachLine { line -> def result = " " (2 - ("" + counter).length()).times { result += " " } result += "${counter}: ${line}" println result counter++ }