当前位置:网站首页>goto语句
goto语句
2022-07-30 05:51:00 【Code Writers】
C语言中goto语句只能在同一个函数段中使用
用法如下:
goto:标签; // 到标签位置
标签:
下图中goto语句的作用相当于break语句。
Java继续使用标签机制,但又不同于C的goto语句用法:
Java的goto语句仅能用于循环语句中
搭配break使用
带标签的break会中断并跳出标签所指的循环。搭配continue使用
带标签的continue会到达标签的位置,并重新进入紧接着标签后的循环中。
goto语句的滥用容易导致代码逻辑结构混乱且增加代码阅读的难度,所以一般来说goto语句在C语言中用的较少,在Java语言中用的更少。
边栏推荐
- Redis下载与安装
- 2020年度总结——品曾经,明得失,展未来
- STL源码剖析:迭代器的概念理解,以及代码测试。
- Test the basics 02
- MongoDB - query
- 开发常用工具软件
- Test Development Engineer Growth Diary 010 - CI/CD/CT in Jenkins (Continuous Integration Build/Continuous Delivery/Continuous Testing)
- Detailed explanation of numpy multidimensional array ndarray
- Test Development Engineer Growth Diary 015 - Top 20 Test Interview Questions
- The calculation proof of the intersection of the space line and the plane and its source code
猜你喜欢

Rodrigues:旋转矩阵的向量表达

云服务器零基础部署网站(保姆级教程)

The Geometric Meaning of Vector Cross Product and the Calculation of Modulus

Proof of distance calculation from space vertex to plane and its source code

Selenium02

Distance calculation from space vertex to straight line and its source code

向量三重积的等式推导证明

Local Implicit Grid Representations for 3D Scenes详解

No, the Log4j vulnerability hasn't been fully fixed yet?

从 Google 离职,前Go 语言负责人跳槽小公司
随机推荐
你被MySQL 中的反斜杠 \\坑过吗?
大飞机C919都用了哪些新材料?
The first artificial intelligence safety competition officially launched
Rodrigues: vector representation of rotation matrices
Linx common directory & file management commands & VI editor usage introduction
What are the access modifiers, declaration modifiers, and keywords in C#?Literacy articles
Electron使用romote报错 : Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
Electron中设置菜单(Menu),主进程向渲染进程共享数据
go : go gin返回JSON数据
How does Redis prevent oversold and inventory deduction operations?
阿里一面:多线程顺序运行有多少种方法?
idea内置翻译插件
Go 结合Gin导出Mysql数据到Excel表格
引导过程与服务控制
As a test leader, examine several aspects of job candidates
不会吧,Log4j 漏洞还没有完全修复?
预测人们对你的第一印象,“AI颜狗”的诞生
Ali: How many methods are there for multi-threaded sequential operation?
Vue项目通过node连接MySQL数据库并实现增删改查操作
图解关系数据库设计思想,这也太形象了