1 2 3 4 5 6 7 8 |
<span class="cm-variable">continueはスキップ(実行しない) numbers</span> = [<span class="cm-number">1</span>, <span class="cm-number">2</span>, <span class="cm-number">3</span>] <span class="cm-keyword">for</span> <span class="cm-variable">number</span> <span class="cm-keyword">in</span> <span class="cm-variable">numbers</span>: <span class="cm-keyword">if</span> <span class="cm-variable">number</span> == <span class="cm-number">2</span>: <span class="cm-keyword">continue</span> <span class="cm-builtin">print</span>(<span class="cm-variable">number</span>) |
を実行した時の出力結果は
1 2 |
<span class="cm-number">1</span> <span class="cm-number">3</span> |
コメントを残す