break and continue
来源:互联网 发布:php socket 长连接 编辑:程序博客网 时间:2024/04/30 21:43
前段时间学Java时,在break与continue上的理解与应用总觉得欠点什么,虽说也能模模糊糊地掌握,可深度总是不够,心里边也总是不那么亮堂。现在学JavaScript时见到一个不错的例子,现在把它总结下。
continue时
For(int i = 0;i<=5;i++){
If(i = =3)continue;
System.out.println("The number is:"+i);
}
结果为:
The number is:0
The number is:1
The number is:2
The number is:4
The number is:5
Break时:
For(int i = 0;i<=6;i++){
If(i = =3)break;
System.out.println("The number is:"+i);
}
结果为:
The number is:0
The number is:1
The number is:2
continue时
For(int i = 0;i<=5;i++){
If(i = =3)continue;
System.out.println("The number is:"+i);
}
结果为:
The number is:0
The number is:1
The number is:2
The number is:4
The number is:5
Break时:
For(int i = 0;i<=6;i++){
If(i = =3)break;
System.out.println("The number is:"+i);
}
结果为:
The number is:0
The number is:1
The number is:2
- break and continue
- Break and Continue
- break and continue
- Break and Continue
- break, continue and return
- break and continue
- Break and Continue
- Break And Continue Of Java
- break and continue的区别
- continue and break for java
- Day12-41.break and continue
- continue break
- continue && break
- break -- continue
- continue break
- continue && break
- break -- continue
- break,continue
- csdn blog 样式code保存
- Linux 指令大全
- MySQL中文乱码问相关资料
- 陌上红尘,可有摆渡人?
- 什么是 EXIF
- break and continue
- vc 皮肤制作!
- 在windows下安装postgre
- 生成包含C库的应用程序----ADS编译器和库文件使用指南 中文翻译(原创)
- resin无法启动
- 变量的声明和定义以及extern的用法
- java世界中常见的产品
- 构造链表的一个注意事项
- 真正爱你的男孩