当前位置:网站首页>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语言中用的更少。
边栏推荐
- Boot process and service control
- [GO语言基础] 一.为什么我要学习Golang以及GO语言入门普及
- 2020年度总结——品曾经,明得失,展未来
- window.open()的用法,js打开新窗体
- VR机器人教你如何正确打乒乓球
- MySQL主从复制配置搭建,一步到位
- Electron中设置菜单(Menu),主进程向渲染进程共享数据
- Mobile phone side scroll to page to specify location
- 空间顶点到平面的距离计算的证明及其源码
- MySQL master-slave replication configuration construction, one step in place
猜你喜欢
Go 结合Gin导出Mysql数据到Excel表格
Station B collapsed, what would you do if you were the developer in charge that night?
Test Development Engineer Growth Diary 010 - CI/CD/CT in Jenkins (Continuous Integration Build/Continuous Delivery/Continuous Testing)
Calculate the inverse source of the matrix (using the adjoint matrix, a 3x3 matrix)
2020 数学建模之旅
Linx常见目录&文件管理命令&VI编辑器使用 介绍
Camera coordinate system, world coordinate system, pixel coordinate system conversion, and Fov conversion of OPENGLDEFocal Length and Opengl
Polygon 3D(三维平面多边形)的法向量的计算(MeshLab默认的计算)
MYSQL-GROUP BY 用法 全网最精,通熟易懂的话解释
让百度地图生成器里的“标注”内容展开--解决方案
随机推荐
2020 数学建模之旅
debian 问题
STL源码剖析:class template explicit specialization代码测试和理解
Process and Scheduled Task Management
The first artificial intelligence safety competition officially launched
计算矩阵的逆源码(使用伴随矩阵,3×3的矩阵)
Huawei released "ten inventions", including computing, intelligent driving and other new fields
Go 结合Gin导出Mysql数据到Excel表格
【MySQL】MySQL中如何实现分页操作
idea内置翻译插件
Detailed explanation of numpy multidimensional array ndarray
From catching up to surpassing, domestic software shows its talents
iptables命令
“AI教练”请进家,家庭智能健身蓬勃发展
MYSQL下载及安装完整教程
开发常用工具软件
Headline 2: there are several kinds of common SQL errors in MySQL usage?
go : go-redis set操作
相机坐标系,世界坐标系,像素坐标系三者转换,以及OPENGLDEFocal Length和Opengl 的 Fov转换
The usage of window.open(), js opens a new form