Slide 28
Slide 28 text
Пытаюсь запустить код
let arr = [1, 2, 3, 4, 5]
for el in arr:
print(el)
/src/test.mojo:2:11: error:
'Tuple[Int, Int, Int, Int, Int]'
does not implement the '__iter__'
method
for el in arr:
^
/src/test.mojo:3:5: error: TODO:
expressions are not yet supported at
the file scope level
print(el)
^
●
Даже самый простой код не заработает!
Питон: Питоmojo:
Mojo:
from python.object import PythonObject
def main():
var arr: PythonObject = [1, 2, 3]
for el in arr:
print(el)
let arr = SIMD[DType.int32, 8](1, 2,
3, 4, 5, 6, 7, 8)
for i in range(8):
print(arr[i])