当前位置:网站首页>Kotlin introductory notes (IV) circular statements (simple explanation of while, for)
Kotlin introductory notes (IV) circular statements (simple explanation of while, for)
2022-07-05 09:14:00 【Meng Meng Mu Xi】
Preface : This tutorial is best done with JAVA Study on the basis of
One 、while Use of statements
while Use and java No different
Two 、for Use of statements
Be careful :kotlin Give up for - i loop , take java Of for ( x : xx ) Turned into for - in loop ( It's written a bit like c#, But it's much more flexible )
So let's talk about that kotlin Characteristics of :
kotlin characteristic :
Section
- Closed interval at both ends eg. val range = 0..10 ( Can take 0 To 10, Closed interval at both ends )
- Front open back close interval eg. vla range = 0 until 10 ( You can get it. 0 To 9, Front opening and back closing )
step keyword
By default ,for-in It will increase in the range 1. But if you want to jump some elements , have access to step keyword .
Such as :
fun main() {
for(i in 0 until 10 step 2) {
println(i)
}
}downTo keyword
Create a descending space
fun main() {
for(i in 10 downTo 1) {
println(i)
}
}for More about will be explained later ...
边栏推荐
- Node collaboration and publishing
- Mengxin summary of LIS (longest ascending subsequence) topics
- C # draw Bezier curve with control points for lattice images and vector graphics
- 浅谈Label Smoothing技术
- Multiple linear regression (gradient descent method)
- Uni app implements global variables
- Applet (global data sharing)
- Applet data attribute method
- Creation and reference of applet
- notepad++
猜你喜欢

Programming implementation of ROS learning 5-client node

Global configuration tabbar

顶会论文看图对比学习(GNN+CL)研究趋势

Understanding rotation matrix R from the perspective of base transformation

混淆矩阵(Confusion Matrix)

Svg optimization by svgo

Information and entropy, all you want to know is here

The combination of deep learning model and wet experiment is expected to be used for metabolic flux analysis

Wxml template syntax

Introduction Guide to stereo vision (7): stereo matching
随机推荐
Blue Bridge Cup provincial match simulation question 9 (MST)
C # compare the differences between the two images
Applet global style configuration window
阿里云发送短信验证码
Rebuild my 3D world [open source] [serialization-2]
Using request headers to develop multi terminal applications
Priority queue (heap)
牛顿迭代法(解非线性方程)
scipy.misc.imread()
AdaBoost use
Meta tag details
Node collaboration and publishing
fs. Path module
Codeforces Round #648 (Div. 2) D. Solve The Maze
[code practice] [stereo matching series] Classic ad census: (6) multi step parallax optimization
什么是防火墙?防火墙基础知识讲解
Return of missing persons
notepad++
Pearson correlation coefficient
【PyTorch Bug】RuntimeError: Boolean value of Tensor with more than one value is ambiguous