Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

🪲 Allow list access to appear on lhs of and/or conditions #5410

Merged
merged 3 commits into from
Apr 16, 2024

Conversation

boryanagoncharenko
Copy link
Collaborator

Fixes #5398
In level 17, the OR and AND conditions could not have a list access on the left hand side. The problem occurs because the ] has optional space after it while the and/or operator has mandatory space before it. When parsing if 'red' == colors[1] and ..., the parser matches the space between ] and and as the optional space after ] and not as the mandatory space before and.

The solution in this PR relaxes the constraint in the and and or operators by making the space before them optional.

How to test

  • Confirm that the following program works correctly in level 17:
f = ['.', '.', '.']
if f[1] == f[2] and f[2] == f[3]
    print 'test'

Copy link
Contributor

mergify bot commented Apr 16, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit d05a9f1 into main Apr 16, 2024
12 checks passed
@mergify mergify bot deleted the condition_error_5398 branch April 16, 2024 19:44
Copy link
Contributor

mergify bot commented Apr 16, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

🪲 Unexpected error in level 17 example code
2 participants