【发布时间】:2019-05-06 14:21:16
【问题描述】:
while 循环中的 continue 指令未执行。 在 Eclipse 调试中,循环只是在 System.out 之后中断。
任何人都知道这可能是什么原因,有没有办法在 cpu 指令级别进行调试,看看会发生什么?
do { // recursive calls through element.parents() until the formula pattern (patternFormula) matches
counter++;
System.out.println(counter);
lookupElement = lookupElement.parent();
String s = replaceArrowTagAndClean(lookupElement.html()); // replace <img .. src=> and return text()
m = patternFormula.matcher(s);
if( (found = m.find()) ) {
oneMoreLookahead = false;
System.out.println("Continue " + counter);
continue;
}
} while(!found || oneMoreLookahead);
System.out.println("End");
输出是:
1
2
3
4
继续 4
结束
(抱歉,创建此帖子时遇到了一些麻烦。哈哈)
【问题讨论】:
-
请出示代码
-
邮政编码本身,而不是代码图像。你希望我们重写它来测试它吗?
-
if found = m.find() 在第一次迭代后为真?
-
此时您的 while 循环中的任何条件都不成立。为什么
continue;应该改变它? -
您的预期结果是什么?为什么你认为它应该表现得那样?
标签: java while-loop continue