while
Node.js
let i = 0
while (i <= 5) {
console.log(i)
i++
}
Output
0
1
2
3
4
5
Go
(there’s no while keyword in Go but the same functionality is achieved by using for)
package main
import "fmt"
func main() {
i := 0
for i <= 5 {
fmt.Println(i)
i++
}
}
Output
0
1
2
3
4
5
当前内容版权归 miguelmota 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 miguelmota .