How do I run selected code?

Is it possible to run a highlighted section of code rather than the whole file? Ghostwriter tells me it should work but it doesn’t work for me.

Ghostwriter says:

Yes, you can execute only the selected code in the Replit IDE.

To run only a selected portion of the code, you can highlight the code you want to run and press CTRL + Enter (Windows, Linux) or Command + Enter (Mac). This will run the selected code and display the output in the console.

Alternatively, you can also right-click on the selected code and choose “Run selection” from the context menu.

Hey @athollt!

We do not support running highlighted or selected code. I am sorry that Ghostwriter gave you incorrect data. This is not intended. We are always working to improve the responses and to ensure that Ghostwriter doesn’t provide incorrect information on how to use Replit.

1 Like