This subroutine is only concerned with getting some data form the user of the program. We want 5 items of data so a counted loop is used:
Line 13: Set up a counted loop with the control variable ‘Line’.
Line 14: Write a prompt ‘Please type a word’ onto the screen leaving the typing cursor on the same line
Line 15: Collect the input from the user and store it in the variable ‘Value’.
Line 16: Write the value in the variable ‘Value’ to the send of the file using the method ‘AppendContents’ – this opens the file and moves to the end so that new values are added at the end.
Line 17: End of the loop.
Using this method means that I don’t need to specify which line to write to – it is the next available line in the file. Also, unlike the TextWindow.WriteLine method, this one takes two parameters – the name of the file to use and the data to be written.