Last Modified: 2024-06-25 14:00:41Z
Table of Contents
The V programming language is a simple, lightweight, and fast programming language. It really looks like the Go programming language at glance.
The V programming language is written in the V language, and the V command can be compiled in less than a second.
1. Try it online
You can try the V language in this playground.
2. Try and install
You can install the V programming language by cloning the git repository and invoking make
.
git clone https://github.com/vlang/v
cd v
make
With Nix, you can try or install vlang
package.
nix-shell -p vlang
Without giving any sub commands, You can get into the REPL session.
$ v
____ ____
\ \ / / | Welcome to the V REPL (for help with V itself, type exit , then run v help ).
\ \/ / | Note: the REPL is highly experimental. For best V experience, use a text editor,
\ / | save your code in a main.v file and execute: v run main.v
\ / | V 0.4.4 ac2dcc2 . Use list to see the accumulated program so far.
\__/ | Use Ctrl-C or exit to exit, or help to see other available commands.
3. Writing a code and run it
This will print "Hello World!" to the console.
// hello.v
println('Hello World!')
You can run it by invoking v run
. It will build a binary from the source code, and delete them instantly.
$ v run hello.v
Hello World!
If you want to persist the executable, just omit the run
sub command.
$ v hello.v
$ ./hello
Hello World!