Course of Raku / Objects, I/O, and exceptions / Input and output / File handles / Exercises

Count the lines

Problem

Write four lines — a, b, c, and d, each on its own line — to a file called data.txt. Then print how many lines the file contains.

Example

The program prints:

4

Solution

See the solution

Course navigation

Solution: Number the lines   |   Solution: Count the lines