When starting a new repl, we create a "main" file for you so you can start coding quickly. However, if you want to split your project into multiple files, you can add new files from the "Files" sidebar.
Then, you can import the files by referencing the file name. Every language will have different syntax for doing this, so please consult the respective language documentation.
Here is an example in Python:
Uploading Files and Assets
You can upload files by either dragging and dropping them into the "Files" sidebar, or by clicking the three dot menu at the top-right of the sidebar and selecting "Upload file" (or folder, if you wish):
We support any file type including images, video, and audio files. These will be displayed correctly in the browser. These files can also be programmatically generated. For example, you can upload an image, alter it programmatically, and save the result to a new image.
There's an example repl that you can play with and fork here (embedded below).
Editing a file
You can edit a file's name or delete it if you wish by clicking on the three-dot icon beside it. When renaming your file, make sure to use the correct file extension.
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:
Programmatic file changes will get synced automatically down to the repl. In the case of images, they will be displayed and updated for you upon each change. This makes it really nice for plotting and data science work, which we cover in Python plots.