The CodeHS editor allows you to create programs using multiple files. Clicking on the file icon on the left-hand side of the editor allows you to create and manage files for your program

arrow points to file icon with pointed brackets

Note:

  • Multi-file programs are not supported with all assignment types.

  • Files cannot be deleted or renamed while students are using blocks.

About Files in Multi-File Programs

All programs have a main file, which is the file that's run when hitting the Run button in the code editor. This file has its file name displayed in bold. You can change the main file in your program by: clicking on the down arrow > Change to Main File

arrow points to green text change to main file

Some programs require specific files in order to run. A good rule of thumb is that if a program comes with files already in place, you should not rename or delete them. If you need additional files, you can always add more!

Creating a New File or Folder

To create a new file or folder:

  1. At the top of the file navigation pane, click New +

  2. Choose File or Folder

  3. Enter the name for your new file or folder and click Add Folder or Add File

If you choose to add a new file, remember to include the extension (.html, .java, etc.)

The icon to the left of the file with change depending on the file type.

shows new file pop up menu and typing

Renaming a File

To rename a file, click the down arrow next to the file name and choose Rename. Enter the new file name and click Save.

shows rename file pop up menu and typing

Deleting a File

To delete a file, click the down arrow next to the file name and choose Delete. Click OK to confirm that you want to delete the file.

shows confirmation prompt delete file

Recovering Deleted Files

If you delete a file by mistake, it can be recovered in the History tab in your code editor.

  1. Go to More > History

  2. Select the timestamp you'd like to go back to

  3. Click Restore from Snapshot

shows clicking on history tab, selecting timestamp, blue restore snapshot button

Still have questions? Contact our team at hello@codehs.com to learn more!

Did this answer your question?