You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
- 1Very interesting. Someday I'll have to figure out how they did that... normally an interpreter wouldn't know where to go if the test fails immediately, so either they do a lookahead or they top test and then roll forward to the NEXT instead of the other way around.Maury Markowitz– Maury Markowitz2022-04-23 20:23:08 +00:00Commented Apr 23, 2022 at 20:23
- 2@MauryMarkowitz - I don't see why being an interpreter prevents a scan over the source code before execution starts.dave– dave2022-04-23 22:12:14 +00:00Commented Apr 23, 2022 at 22:12
- 1@MauryMarkowitz: there's also no requirement to scan up front. You could do something like have a flag indicating "I'm in a dead for loop" which reads but doesn't execute code. You stay in that mode until you get to the corresponding NEXT (so you'll probably need to stack dead FOR/NEXT pairs) then turn off the flag. Not how I would do it, I'd prefer pre-scan to speed things up.user15022– user150222022-04-23 23:50:58 +00:00Commented Apr 23, 2022 at 23:50
- 3I understand the hesitation, but finding the closest NEXT forward shouldn’t be fundamentally harder than implementing GOTO to a forward line number.Euro Micelli– Euro Micelli2022-04-24 00:12:59 +00:00Commented Apr 24, 2022 at 0:12
- 3@paxdiablo: "When the value of the simple variable passes the final value": the initial value has already passed the final value if N=0, so the loop is never entered.scruss– scruss2022-04-24 02:22:53 +00:00Commented Apr 24, 2022 at 2:22
| Show 14 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. ms-dos), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you