增加'我'斯卡拉循环由不同的数额取决于情况 [英] Incrementing 'i' in scala for loop by differing amounts depending on circumstance
本文介绍了增加'我'斯卡拉循环由不同的数额取决于情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在scala中写一个for循环,但是在一些特殊情况下,计数器应该增加多于一个(数量是可变的)。
I want to write a for loop in scala, but the counter should get incremented by more than one (the amount is variable) in some special cases.
推荐答案
var x = 0;
do{
...something
if(condition){change x to something else}
else{something else}
x+=1
}while(some condition for x)
这篇关于增加'我'斯卡拉循环由不同的数额取决于情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文