Skip to content

For Loops Not Executing Correctly in SimpleScript #1

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
ghost opened this issue Apr 7, 2025 · 0 comments
Open

For Loops Not Executing Correctly in SimpleScript #1

ghost opened this issue Apr 7, 2025 · 0 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed invalid This doesn't seem right

Comments

@ghost
Copy link

ghost commented Apr 7, 2025

For Loops Not Executing Correctly in SimpleScript

Description

In SimpleScript, for loops do not execute as expected. When using a typical loop like for (let i = 1; i <= 5; i++), the loop either does not iterate correctly or breaks prematurely. This disrupts core control flow functionality and limits usage in real-world scenarios.

Steps to Reproduce

  1. Write a SimpleScript program with a for loop:
    for (let i = 1; i <= 5; i++) {
        print(i);
    }
  2. Run the script using the interpreter/web interface.
  3. Observe the output.

Expected Behavior

The loop should print the numbers from 1 through 5:

1
2
3
4
5

Actual Behavior

The output either shows only the first value, skips iterations, or nothing is printed at all.

Possible Causes

  • Off-by-one error in loop bounds
  • Interpreter not handling loop initialization or increment properly
  • Incorrect tokenization or parsing of the for loop structure

Environment

Additional Context

This issue affects the usability of SimpleScript in basic looping tasks and may hinder educational use cases. A fix should ensure:

  • Proper parsing and evaluation of loop bounds
  • Execution of loop body on each iteration
  • Correct variable scope management

Please investigate and fix the issue. Happy to test and provide feedback!


Thanks for your hard work!

@ghost ghost added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers invalid This doesn't seem right labels Apr 7, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

0 participants