Course of Raku / Objects, I/O, and exceptions / Input and output / Working with files / Exercises

Build up a log

Problem

Build a small log file by appending to it repeatedly. Write the line start to a file called log.txt, then use a loop to append three more lines — entry 1, entry 2, and entry 3 — without erasing what is already there. Finally, read the whole file and print it.

Example

The program prints:

start
entry 1
entry 2
entry 3

Solution

See the solution

Course navigation

Solution: Save and read   |   Solution: Build up a log