简体   繁体   中英

Putting a while loop into a for loop

无论如何只需将其转换为for循环?

while ((something == false) && (s < string.length-1)){ }
for( <x> ; (something == false) && (s < string.length-1) ; <y> ){
 //do whatever
}

put into x whatever you need to declare and into y whatever should increment everyloop, if anything. You can have nothing in there too.

for(int i=false;i<string.length-1;i++)

我想这会奏效

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM