Language Guide
the core building blocks of netdust: rooms, variables, importing
libraries with bring, and control flow.
if you haven't run a file yet, start with
Getting Started first.
Rooms
there is no bare global scope in netdust — every block of
code lives inside a room. the entry point of any program is
a room called main.
room main(): call std.io.println("hello, world") end;
a room is opened with room name(): and
closed with end;. other rooms can be
defined the same way and invoked with call.
Variables
netdust has two variable keywords, and the keyword itself carries the type:
| keyword | type | example |
|---|---|---|
var |
string | var x = "5" |
num |
number | num y = 5 |
var name = "nknnt" num age = 10 call std.io.println(name)
var always means string, and
num always means number — the
keyword itself is the type, there's no separate type annotation.
Importing with bring
bring : lib pulls a single library
into scope directly:
bring : std.io bring : std.math
bring flat
bring flat : lib is used inside
an index library file to re export other library files as one
unit. for example, ntd/ui.nd might
flat bring window.nd and
label.nd:
// inside ntd/ui.nd bring flat : ntd.ui.window bring flat : ntd.ui.label
so a user only needs one line to get everything ui.nd exposes:
bring : ntd.ui
bring flat when building an index
library that groups other files together — regular
bring is what most .nd
scripts will use.
Control Flow
if
if(age > 5): call std.io.println("older than five") end;
while
while uses the same
cond ): ... end;
shape as if:
num i = 0 while(i < 5): call std.io.println(i) i = i + 1 end;
for
for supports two forms — a
C-style loop, and a range-style loop:
// C-style for(i=0, i<10, i=i+1): call std.io.println(i) end; // range-style for(i in 0..10): call std.io.println(i) end;
break / continue
for(i in 0..10): if(i == 3): continue; end; if(i == 7): break; end; call std.io.println(i) end;
while/for
plus break;/continue;
are actively being finalized — syntax on this page may still
shift slightly before release.
Next steps
-
browse the standard library array, convert, io, math, random, string, time — all under std/.
-
browse ntd/ ui, fs, netclient — platform-facing modules for GUI, filesystem, and networking.
-
go beyond headless run the same .nd source inside noctura, the GUI application host runtime.