如何转到 While 循环的下一个值 [英] How to go to the next value of a While loop

查看:43
本文介绍了如何转到 While 循环的下一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 While 循环,它读取 file.txtline.我还有一个名为 VerifyPhoto 的方法,它返回 true/false 如果返回值是 true/false 我想转到 while 循环 的下一项代码>假.我怎么能那样做?我尝试了 breakreturn 但它只是保留所有并返回到 form...

I have a While loop that reads a line of a file.txt. I also have a method named VerifyPhoto that returns true/false I want to go to next item of the while loop if the returned value is false. How Could I do that ? I tried break and return but it just leave all and back to the form...

while (!reader.EndOfStream)
  {
     if(VerifyPhoto(filed.matriculation) == false)
        {
          //go to the next line of the file.txt
        }
  }

推荐答案

您可能想熟悉其他控制语句:继续

You may want to get familiar with other control statement: continue

最新版本的文档:继续,谢谢杰普.

Newest version of the doc: continue, thanks Jeppe.

这篇关于如何转到 While 循环的下一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆