How to iterate through an array/list?
Hello, I'm coming from Java to Mojo.
It seems there is no support for iterating with "for" through a list - at least in the present version of Mojo. Here's the code:
Should work, doesn't it? It does work in Python.
Thanks.
5 Replies
lines looks like Tuple, not like List. Why not List((Int, Int),...) ?
Throws an error.
![No description](https://cdn.answeroverflow.com/1247224221478944811/image.png)
it's strange to me as well
Tuples are still a little rough around the edges last time I checked. You also can't use a list here unless you also use a variant since lists must be of a single type. I'd probably just make a simple struct since the type is quite large and unwieldy looking.
Congrats @Ryulord, you just advanced to level 6!