We introduced files to our environment back in May due to it being one of the most asked for features on the site. We knew this will add a new level of complexity, but we felt that it is a very empowering feature. I will not dive into the design and planning process here, but as always we tried to keep it as simple as possible without limiting you.
In any language where we support multiple files, you can create a new file by clicking on the icon. Or upload one from your computer by clicking .
We support uploading any file type including images and videos which will be displayed correctly. For example, you can upload an image, alter it programmatically, and save the result to a new image. Like this (which you can try out here):
This will put you in project mode which behaves slightly differently than the normal repl. Keep in mind The first file is always the entry point (typically named main), you won't be able to evaluate code in the console (it can only be used for STDIN), and any changes your program makes to files will be updated live.
You can edit a file's name or delete it if you wish by clicking on the icon beside it. If you're renaming your file, make sure you have the right extension for it.
Two things to note about files:
- They can be of any type/extension and you can use them in your code however you'd like.
- Files will be placed in the current working directory, generally you'd access it through the relative path './filename.ext'.
Here's a few examples on files in different languages: