Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
object PrintWithLineNumber{
import scala.io.Source
def printWithLineNumber( fileName:String ) =
Source.fromFile( fileName ).
getLines.
zipWithIndex.
map{ case ( s, n ) => "%s:%s" format( n, s ) }.
foreach{ print }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.