Types permitted in for loop variable declarations?
类型允许在循环变量的声明?
For-each loop: When iterating over an array, the compiler generates an induction variable and the standard array iteration idiom.
for - each循环:当迭代数组时,编译器生成归纳变量和标准的数组迭代语法。
So, the best declaration for an int variable in a tight loop would be.
那么,在一个小循环(tight loop)中,定义一个整型变量,最好类似这样。
And we won't wait here one hundred seconds for it to finish, but we're using the loop, we're updating a variable, and we're formatting it in a nice way.
我们将不会再这里等待100秒来等它完成,但是我们使用循环,我们更新一个变量,我们把它排成一个漂亮的格式。
But notice unlike a for loop, if you want to declare a variable or increment or decrement to variable, you've got to do that yourself.
但请注意不像for循环,如果你想声明一个变量,或者变大或变小一个变量,你需要自己完成。
应用推荐