Skip to content

Doc: Add in keyword page - #30

Draft
Zoroark-Zwart wants to merge 14 commits into
Timiodon:mainfrom
Zoroark-Zwart:add-in-keyword-page-may-2026
Draft

Doc: Add in keyword page#30
Zoroark-Zwart wants to merge 14 commits into
Timiodon:mainfrom
Zoroark-Zwart:add-in-keyword-page-may-2026

Conversation

@Zoroark-Zwart

@Zoroark-Zwart Zoroark-Zwart commented May 21, 2026

Copy link
Copy Markdown
Contributor

Overview

The purpose of this suggestion is to make the in operator visible in the help docs beyond being used in conjunction with for in the For Loops page. Since in can be used to see if a value is in any sequence, it is a powerful feature that is not highlighted in the docs.

To make this addition, I created a new scripting page that helps to explain the operator and gives 2 examples using. These examples feature 2 coding problems that are asked and discussed in the Discord help channel frequently.

Discord Suggestions thread: https://discord.com/channels/988081966035402783/1506854230185611374

Pull Request (PR)

The PR is in draft mode because it requires additional translations. I have provided an EN version and tried to add changes to other languages where I can. I have noted the changes and additions below.

Concerns for Functionality

Suggestion link: https://discord.com/channels/988081966035402783/1506852343906570330

For now, I have put the true costs in the timings.md page.

Changes

These things have been changed for all languages and don't need translations.

home.md

Added an in link under the Unlocks category. Changed the unlock permission for tuples to variables.

Changes made for all languages.

for.md

Reordered the Sequences section and changed unlock permission for tuples to variables

Additions

Here are all of the additions that would need translations.

in.md

Completely new. Added the EN version to all languages with only the Sequences section translated using the same section from for.md

list.md

Added an example:

You can also check if a value exists in a list. The following example checks to see if `6` is in `numbers`:

`numbers = [8, 6, 1, 10]
if 6 in numbers:
	do_a_flip()`

operators.md

Added this at the top under Boolean operators:

<unlock=variables>existence operator: `in`</unlock>

Added this under the Logic Operators section:

## Existence Operator

`in` can only be used with sequences and checks to see if a value is in that sequence.

`1 in (1, 2)` evaluates to `True`
`not 3 in (1, 2)` evaluates to `True`
`3 not in (1, 2)` evaluates to `True`
`"Goodbye" in "Hello World"` evaluates to `False`
`not "Goodbye" in "Hello World"` evaluates to `True`
`"Goodbye" not in "Hello World"` evaluates to `True`</unlock>

timings.md

The `in` operator:
- takes one tick to search a set or dict
- takes `# comparisons` ticks to search a list or tuple
- takes `len(string)` to search a string
- takes `8` ticks to search a tuple

@Zoroark-Zwart Zoroark-Zwart changed the title Add in keyword page may 2026 Doc: Add in keyword page May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant