Hello World
Your first Vexel program. This page walks through the minimal structure of a Vexel source file and shows you how to run it.
Your First Program
Create a file called hello.vx and add the following:
fn main():
print("Hello, World!") Run it with:
vexel run hello.vx
Output:
Hello, World!
Understanding the Structure
The main function
Every Vexel program must have a main function. It is the entry point — execution starts there. The function takes no parameters and returns nothing.
fn keyword
fn declares a function. The colon at the end of the signature opens the function body. The body is indented with four spaces.
Indentation
Vexel uses indentation — not curly braces — to define code blocks. The standard indent is 4 spaces. Mixing tabs and spaces will produce a parse error.
print is a built-in function that writes a value to standard output followed by a newline. It accepts any type — int, float, str, or bool.
Compiling to a Native Binary
vexel run JIT-compiles and executes immediately. To produce a standalone binary:
# compile to hello.exe (Windows) or hello (Linux/macOS) vexel compile hello.vx -o hello # run the binary directly ./hello
The compiled binary has no dependency on Vexel or Python. It links only the small Vexel garbage-collected runtime which is embedded automatically.
Comments
Vexel supports single-line comments starting with #. Everything after the # on that line is ignored by the compiler.
# This is a comment
fn main():
# print outputs to stdout
print("Hello") # inline comment