Skip to content

How do you separate Mint code in a plurality of files (or how do you "import" code between Mint files) ? #561

Discussion options

You must be logged in to vote

How do you separate Mint code in a plurality of files (or how do you "import" code between Mint files) ?

Every Mint project has a mint.json file which specifies the directories which contain source code: https://github.com/mint-lang/mint-realworld/blob/master/mint.json#L4

All *.mint files are parsed in the source directories and all entities are available in all files, so there is no need to import.

For instance, how would you put the module Greet in a separate file and call it in the main module file

Just create a new file Greet.mint (the name doesn't matter) in the source directory (which is the default) put the module there and that's it.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by serge-hulne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants