-2

I'm almost new to python and I'm making a kind of command line. I want to make it keep open after pressing enter. In C#, I used goto for example:

start:
a = Console.ReadLine("Enter Command:");
goto start;

But now, I don't know how to do that in python.

  • What should the program _do_ after the user input? Your C# program just asks the user for new input forever, which is not really all that useful. – phihag Jan 04 '19 at 10:52
  • 3
    Use a `while` loop? – ForceBru Jan 04 '19 at 10:52
  • 2
    There is not goto statement in Python, also even in languages where it is available using it is often considered bad practice c.f. https://stackoverflow.com/questions/3517726/what-is-wrong-with-using-goto – Daweo Jan 04 '19 at 11:05

2 Answers2

3

There is no goto in Python. However you can create an infinite loop.

while True:
   input()
rvs
  • 1,251
  • 13
  • 22
-1

An example:

while True == True:
    dum = raw_input("Enter Command:")
msi_gerva
  • 2,021
  • 3
  • 22
  • 28