ModularM
Modular3y ago
4 replies
ekjokesunaukya

error: TODO: expressions are not yet supported at the file scope

I get this message when I run this code from docs.

fn add(x: Int, y: Int) -> Int:
    return x + y

z = add(1, 2)
print(z)


Error:
test.mojo:4:1: error: TODO: expressions are not yet supported at the file scope level
z = add(1, 2)
^
test.mojo:4:1: error: use of unknown declaration 'z'
z = add(1, 2)
^
test.mojo:5:1: error: TODO: expressions are not yet supported at the file scope level
print(z)
^
test.mojo:5:7: error: use of unknown declaration 'z'
print(z)
      ^
image.png
Was this page helpful?