Course of Raku / Objects, I/O, and exceptions / Input and output / File handles / Exercises
Write with a handle
Problem
Open a file called out.txt for writing. Keeping the
handle open, write the numbers 1, 2, and
3 to it, each on its own line, using a loop. Then close the
handle, read the file back, and print its content.
Example
The program prints:
1
2
3Solution
Course navigation
← Solution: Count the lines | Solution: Write with a handle →