当前位置:网站首页>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语言中用的更少。
边栏推荐
- The newcomer deleted data by mistake, and the team leader skillfully used MySQL master-slave replication to delay the recovery of losses
- Upload file -- file type, picture type, document type, video type, compressed package type
- 舒尔补(schur completement)
- LVM and disk quotas
- go : go gin返回JSON数据
- DHCP原理与配置
- 云服务器零基础部署网站(保姆级教程)
- Test Development Engineer Growth Diary 015 - Top 20 Test Interview Questions
- Go 使用mencached缓存
- (GGG)JWT
猜你喜欢

When does MySQL use table locks and when does it use row locks?

人工肌肉智能材料新突破

idea内置翻译插件

DHCP principle and configuration

What are the access modifiers, declaration modifiers, and keywords in C#?Literacy articles

搭建vsftpd服务并实现本地用户访问

首届人工智能安全大赛正式启动

向量叉乘的几何意义及其模的计算

Huawei released "ten inventions", including computing, intelligent driving and other new fields

Proof of distance calculation from space vertex to plane and its source code
随机推荐
numpy 多维数组ndarray的详解
The Geometric Meaning of Vector Cross Product and the Calculation of Modulus
The Society of Mind - Marvin Minsky
bean的生命周期
Graphical relational database design ideas, this is too vivid
DNS域名解析服务
首届人工智能安全大赛正式启动
AI元学习引入神经科学,医疗效果有望精准提升
Electron之初出茅庐——搭建环境并运行第一个程序
千万级数据量的表,怎样最快速度查询?
MongoDB - query
Electron之初出茅庐——搭建环境并运行第一个程序
向量三重积的等式推导证明
Go 结合Gin导出Mysql数据到Excel表格
阿里二面:Sentinel vs Hystrix 对比,如何选择?
New breakthrough in artificial muscle smart materials
Redis download and installation
LVM and disk quotas
idea built-in translation plugin
阿里二面:Redis有几种集群方案?我答了4种