Read a specific line from a file: Difference between revisions
Read a specific line from a file (view source)
Revision as of 22:06, 16 September 2014
, 9 years ago→{{header|Ruby}}: replaced completely using newer methods.
(→{{header|Ruby}}: replaced completely using newer methods.) |
|||
Line 1,024:
=={{header|Ruby}}==
The each_line method returns an Enumerator, so no more than seven lines are read.
<lang ruby> seventh_line = open("/etc/passwd").each_line.take(7).last
</lang>
=={{header|Run BASIC}}==
|