Hello World
Your first VDX program. Starting with v0.0.15, a class wrapper is optional — you can write top-level statements directly.
1. Create a file
Create a file called hello.vdx:
print("Hello, world!");Or with a class wrapper (recommended for larger programs):
class Hello {
print("Hello, world!");
}2. Run it
vdx hello.vdxOutput:
Hello, world!3. What happened?
print("Hello, world!");— prints text to the terminal. Every statement ends with;class Hello { ... }— declares a class namedHello. Classes are optional but recommended for organizing larger programs.
A bigger example
let name = "VDX";
print("Welcome to", name);
print(1 + 1);
print(10 * 3 + 2);
fn greet(who) {
print("Hello,", who);
}
greet("developer");Output:
Welcome to VDX
2
32
Hello, developer