How to use goto in python on replit

Question:
How do I get goto to work in python
Repl link:
https://replit.com/@LandonKuehner/goto-testing

Hello, I don’t understand what you mean by this. Can you explain? Also please tell me what the “Goto” does.

Hello, it appears you’re expecting “goto” to work like it does in bash, or some other programming language that uses it. However python does not have a “goto” command. There are external modules you could potentially use instead, but I cannot speak for how reliable they are.
Edit: I did not check the repl you provided for implementation of this, here’s a better answer taking that repl into account:
From goto’s PyPI page:

from goto import with_goto

@with_goto
def range(start, stop):
    i = start
    result = []

    label .begin
    if i == stop:
        goto .end

    result.append(i)
    i += 1
    goto .begin

    label .end
    return result

Taking your code into account:

from goto import with_goto

@with_goto
def function():
  label .area_1
  print("value")
  label .area_1
  goto .area_2

Notes:

  • This code will (probably) error when run, as there is no label for “.area_2”
  • This really isn’t how a program like this should be done, as it’s not “pythonic”, what exactly is this supposed to do?

Never mind, I don’t suggest using the ‘goto’ thing. I suggest using IF statements. You could try my replit.

Replit: https://replit.com/@curhahn/For-Landon

Have a great day!