ReadASpecificLine.frink

Download or view ReadASpecificLine.frink in plain text format

/** This is a solution to the Rosetta Code problem
    "Read a specific line from a file."
    https://rosettacode.org/wiki/Read_a_specific_line_from_a_file
*/

nthLine[filename, lineNum] :=
{
   line = nth[lines[filenameToURL[filename]], lineNum-1]
   if line != undef
      return line
   else
   {
      println["The file $filename does not contain a line number $lineNum"]
      return undef
   }
}


Download or view ReadASpecificLine.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19355 days, 10 hours, 38 minutes ago.