1 2 3 4 5 6 7 |
<span class="cm-variable">numbers</span> = [<span class="cm-number">1</span>, <span class="cm-number">2</span>, <span class="cm-number">3</span>, <span class="cm-number">4</span>, <span class="cm-number">5</span>, <span class="cm-number">6</span>, <span class="cm-number">7</span>, <span class="cm-number">8</span>, <span class="cm-number">9</span>, <span class="cm-number">10</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-builtin">print</span>(<span class="cm-variable">number</span>) <span class="cm-keyword">if</span> <span class="cm-variable">number</span> <span class="cm-operator">></span>= <span class="cm-number">5</span>: <span class="cm-builtin">print</span>(<span class="cm-string">"続きはこちら"</span>) <span class="cm-keyword">break</span> |
この時の実行結果は、
1 2 3 4 5 6 |
<span class="cm-number">1</span> <span class="cm-number">2</span> <span class="cm-number">3</span> <span class="cm-number">4</span> <span class="cm-number">5</span> <span class="cm-variable">続きはこちら</span> |
コメントを残す