Nim: How to import variable declared in another file

4210 views nim
-5

I have a variable defined in a file like

# one.nim
let someVar = SomeClass()

I want to be able to use this variable in another file as something like:

# two.nim
let _ = someVar.method()

what changes do I need to make something like this happen?

answered question

1 Answer

3

just making the variable exportable by appending a * will make someVar importable.

# one.nim
let someVar* = SomeClass()

posted this

Have an answer?

JD

Please login first before posting an answer.