Python3 goto 语句的使用

  • 2019 年 11 月 5 日
  • 筆記

首先安装一个 goto 的包(因为官方是没有 goto 语句的)

pip install goto-statement

具体的语法

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