Skip to content
Sign upLog in
← Back to Community

How to selectively run code?

Profile icon
AnnaHoffman

In other IDEs, I can highlight the code I want to run, and then select CTRL + ENTER to run only that selection. Is that possible in repl? If so, how?

Thank you!

Voters
Profile icon
AnnaHoffman
Comments
hotnewtop
Profile icon
Coder39182

I assume you could comment everything else out? If it helps Repl uses mash(at least for C++).

Profile icon
AnnaHoffman

@JoeyRueff
Thanks Joey. Is there a keyboard toggle for commenting? That wouldn't be too difficult...

Profile icon
Coder39182

@AnnaHoffman
to comment something out just type """ at the start where you want it to be commented out and then """ at the end. The part commented out won't run.

Profile icon
AnnaHoffman

Oh yeah. That would work. Not quiiitte as nice as a keyboard toggle in VSCode, but I'll take it! Thank you

Profile icon
Coder39182

No problem!

Profile icon
Codemonkey51

You could make a new file with only that code and name it test.py then create a file named .replit and set its content to:

language="python3" run="python3 test.py"

and then when you are done just change it to:

language="python3" run="python3 main.py"