Search
Star
Feedback
Setup for Free
© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
scope of iteration variable - Modular
M
Modular
•
3y ago
•
2 replies
gryznar
scope of iteration variable
fn main():
var i: Int
for
i
in
range
(
3
):
...
fn main():
var i: Int
for
i
in
range
(
3
):
...
In current state of Mojo
, variable
i
i
is visible only inside the loop
, which means that
i
i
outside the loop is another
i
i
. Is this only temporary solution or there are greater pros to keep this
?
Modular
Join
This server is the home of the MAX and Mojo community! Join us to chat about all things Modular.
20,199
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Recent Announcements
Similar Threads
Was this page helpful?
Yes
No
Similar Threads
Check type of a variable
M
Modular / questions
2y ago
Assigning slice of a tensor to a variable?
M
Modular / questions
2y ago
Printing the type of a variable in Mojo
M
Modular / questions
3y ago
Global variable support?
M
Modular / questions
2y ago