多重ループを抜ける

実際に使ったかどうかは記憶が定かではないのだが、多重ループを一気に抜ける場合の方法は、gotoを使うことしか知らなかった。

ところが、である。Pythonの本を読んでいたら、elseとcontinueを使う方法と、フラグ変数を使う方法の2つが出ていて、軽く衝撃を受けた。前者はelseだけを使うという意味で、後者はC言語でもgotoより一般的な方法らしいのに、今まで知らなかったことに…

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny