← Back to Docs

Hello World

Your first VDX program. Every VDX program starts with a class declaration.

1. Create a file

Create a file called hello.vdx:

class Hello {
    print("Hello, world!");
}

2. Run it

vdx hello.vdx

Output:

Hello, world!

3. What happened?

  • class Hello { ... } — declares a class named Hello. All code lives inside a class.
  • print("Hello, world!"); — prints text to the terminal. Every statement ends with ;

A bigger example

class Hello {
    let name = "VDX";
    print("Welcome to", this.name);

    print(1 + 1);
    print(10 * 3 + 2);

    fn greet(who) {
        print("Hello,", who);
    }

    greet("developer");
}

Output:

Welcome to VDX
2
32
Hello, developer