Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I just came across a pretty good lead buried in the comments of <a href="https://stackoverflow.com/questions/101268/hidden-features-of-python">this far more general question</a>. User ΤΖΩΤΖΙΟΥ wrote:</p> <blockquote> <p>Anyone remember the FOR var … NEXT var … END FOR var of Sinclair QL's SuperBasic? Everything between NEXT and END FOR would execute at the end of the loop, unless an EXIT FOR was issued. That syntax was cleaner :)</p> </blockquote> <p>An <a href="http://www.worldofspectrum.org/faq/resources/documents.htm" rel="nofollow noreferrer">OCR rendition of Sinclair QL User Guide</a> happens to float on the internet. It reads: </p> <blockquote> <p>A NEXT statement may be placed in a loop. It causes control to go to the statement which is just after the opening keyword FOR or REPeat. It should be considered as a kind of opposite to the EXIT statement. By a curious coincidence, the two words NEXT and EXIT both contain EXT. Think of an EXTension to loops and:</p> <ul> <li>N means "Now start again"</li> <li>I means "It's ended"</li> </ul> </blockquote> <p>A fascinating example follows:</p> <blockquote> <p>The sheriff has a gun loaded with six bullets and he is to fire at the bandit but two more conditions apply:</p> <ol> <li><p>If he hits the bandit he stops firing and returns to Dodge City.</p></li> <li><p>If he runs out of bullets before he hits the bandit, he tells his partner to watch the bandit while he (sheriff) returns to Dodge City.</p></li> </ol> </blockquote> <pre><code>100 REMark Western FOR with Epilogue 110 FOR bullets = 1 TO 6 120 PRINT "Take aim" 130 PRINT "FIRE A SHOT" 140 LET hit= RND(0 TO 1) 150 IF hit = 1 THEN EXIT bullets 160 NEXT bullets 170 PRINT "Watch Bandit" 180 END FOR bullets 190 PRINT "Return to Dodge City" </code></pre> <p>So, under a different (and arguably less disturbing) syntax, it's exactly the same semantics.</p> <p>Wikipedia tells us that the Sinclair QL launched in February 1984 as the successor to the Sinclair ZX Spectrum, but failed to achieve commercial success.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload