-
Notifications
You must be signed in to change notification settings - Fork 26
Modules
Rohan Singh edited this page Feb 14, 2025
·
2 revisions
Code can be split across multiple files (modules) for better organization and reuse. The Require core library must be included to use modules. Note that modules can be loaded from non-filesystem sources by configuring the Require Library.
File main.mnd:
from Constants import { maxValue };
import Util;
const value = Util.clamp(100, 0, pi);
File Util.mnd:
export fun clamp(value, min, max) {
if (value < min) return min;
if (value > max) return max;
return value;
}
File Constants.mnd:
export const pi = 3.14159; // ...
Full file names (including relative paths) can also be specified by using a string literal in place of a module name.