# Comprehension

```python
myNums = [1, 90, 50, 32]
mySquared = (num**2 for num in myNums)

for i in mySquared:
    print(i)
```

is valid code now even after compiling to Luau.

```lua
local myNums = {1, 90, 50, 32}
local mySquared = (function() local result = {} for num in myNums do table.insert(result, (num ^ 2)) end return result end)()
for i in mySquared do
    print(i)
end
```

Dictionary and List comprehension is also supported.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rcc-1.gitbook.io/roblox-py/language/comprehension.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
