Inline modules
Inline modules are modules are defined with the mod keyword,
followed by a name and a body {...} as the following example shows:
mod my_module {
// e.g. define a constant
pub const VALUE = 1;
}
The following statements can be used within an inline module:
| Statement | Purpose | Example |
|---|---|---|
| const assignment | naming constants | const Y = 1; |
| pub assignment | exporting constants | pub Y = 1; |
| function | separate calculations | fn f() { } |
| workbench | build or transform 2D sketches and 3D parts | part P() { } |
| module | modularization of complex code | mod m { } |
| use | use elements from other modules | use m; |
| comment | for documentation | //! comment |