首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Python3 goto 语句的使用

Python3 goto 语句的使用

作者头像
狼啸风云
修改于 2022-09-03 20:58:56
修改于 2022-09-03 20:58:56
4.3K0
举报

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

代码语言:javascript
复制
pip install goto-statement

具体的语法

代码语言:javascript
复制
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
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/11/04 ,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档