强制循环迭代

Mik*_*lls 3 c# foreach loops

在我的"原生"编程语言(RPG)中,我可以编写一个循环,然后离开循环或强制迭代.它有点像GOTO.

dow (x < 999);
  read file;
  if (%eof);
    leave; // Leave the loop
  endif;
  if (field <> fileField);
    iter; // Iterate to the next record
  endif;
enddo;
Run Code Online (Sandbox Code Playgroud)

我的问题是,是否有类似的选项是C#.就我而言,我正在使用foreach循环.

Ada*_*ght 18

continue; // Goto the next iteration
break; // Exit the loop
Run Code Online (Sandbox Code Playgroud)


i_a*_*orf 5

Break将退出循环. 继续将跳转到下一次迭代.