Coding for All
Level 10: Adding to a File
Adding to a File Add a line without wiping out what is already there.

Two arrows, >>, mean "add to the end" rather than "replace". This is how a file gets built up one line at a time.

Picture what a single > would have done here: "Hello there" would be gone, with nothing to get it back. One extra character is the whole difference.

TYPE the file afterwards and both lines are there, in the order they were added.

ECHO Second line >> HELLO.TXTAdd to the end.
ECHO Oops > HELLO.TXTReplace everything (careful!).
Your task
  • Add a second line to HELLO.TXT with >>
  • Check both lines survived

Open this level in your browser to type the commands at a live terminal that answers back.