Karthik Divi
·3 min read

V Online Compiler - Write and Run V (Vlang) Code Online

V (also called Vlang) is a systems programming language that compiles an entire project in under a second. Not a small file -- a full project. It aims to be as simple as Go, as fast as C, and it does not use a garbage collector.

That last part surprises people. V manages memory through a combination of autofree and arena allocation. No GC pauses, no manual malloc/free. The compiler figures out when to deallocate.

Trying V without installing it

V is still a young language. The toolchain is straightforward to install, but if you just want to see what the syntax looks like or test a small idea, setting up a local environment is unnecessary overhead. An online V compiler gets you from curiosity to running code in about ten seconds.

This is useful when you are:

  • Curious about V after reading about it and want to try the syntax
  • Comparing V's approach to Go or Rust or C for a specific pattern
  • Writing a small algorithm to see if V's simplicity claims hold up
  • Sharing a V snippet in a discussion or blog post

A simple V program

V's syntax is minimal. No semicolons, no curly braces for single-expression blocks, no header files. Here is a program that shows a few of its features:

struct Point {
    x f64
    y f64
}

fn (p Point) distance(other Point) f64 {
    dx := p.x - other.x
    dy := p.y - other.y
    return (dx * dx + dy * dy)
}

fn main() {
    cities := {
        'Berlin':  Point{52.52, 13.405}
        'Munich':  Point{48.1351, 11.582}
        'Hamburg': Point{53.5511, 9.9937}
    }

    for name, loc in cities {
        d := loc.distance(cities['Berlin'])
        println('${name} -> Berlin: ${d:.2}')
    }
}

A few things to notice. Structs have methods attached via receiver syntax, similar to Go. Variable declarations use := and are immutable by default -- you need mut to make them mutable. The string interpolation just works with ${}.

C interop without the pain

One of V's selling points is seamless C interoperability. You can call C functions directly without writing bindings or using FFI. The compiler translates V to C as an intermediate step, so the interop is essentially free. For systems programming tasks where you need to call into existing C libraries, this matters a lot.

Why OneCompiler for V?

Since V compiles fast by design, an online compiler for V feels snappy. OneCompiler's V compiler lets you write and run Vlang code without downloading anything.

What works well:

  • Compilation and execution happen quickly, matching V's speed promises
  • The editor is simple, which fits V's philosophy
  • You get a shareable URL for every program, handy for discussions
  • No account needed to start writing code

V is worth exploring if you want something that compiles to native code but reads like a scripting language. The online compiler is the fastest way to form your own opinion.

Try it here: V Online Compiler on OneCompiler