Stop python code with function?
EricBromstead (12)

Hello Again, This time I was wondering what function I could use to stop the repl.it python program, I have tried exit() quit() sys.exit() and they stop the code from continuing but don't stop the repl.it from running, any way to fix this?

You are viewing a single comment. View All
JoshDaBosh (77)

if you've learned about user defined functions, you could put all your code into function main() and call it. Whenever you need it to stop running, you would simply just put the statement return in your code.
If you need more help, please link your repl. ^^

EricBromstead (12)

@JoshDaBosh Ok this is what I was thinking but I don't want to have to put a tab on every line of main code... but if this is the only way so be it, also was scrolling through the ask section and basically, all my questions are in like the top 50... So From now on before I post! Look for it in repl talk!

JoshDaBosh (77)

@EricBromstead nice.
quick type (hopefully gets to you before you do it manually) - if you want to indent something in python simply highlight the region and press "tab" or do "command"(or ctrl)+"}".

If you want to unindent something then do "command"(or "ctrl")+"{".

artr (0)

@JoshDaBosh im trying to make my repl go back to the start after an answer, do you have any ideas, would be happy to give you access