UNLIMITED

Linux Format

Discover the all-new V language

Credit: https://vlang.io

No, V isn’t a fan fiction release of the famous 1980s TV series. Instead, it’s a fast, modern, open source, statically typed compiled programming language. V can be used in various areas including web development, systems programming, embedded programming, graphical user interfaces and mobile development. So, all the usual then!

You can install V on an Arch Linux system that uses paru by running paru -S vlang with root privileges. Use your favourite package manager to install V on your own Linux distribution or follow the instructions found at the GitHub repository of V for a manual installation (see https://github.com/vlang/v). The name of the V compiler is just v. You can discover the version of V you’re using by running v --version on your Linux shell. V source code files have the .v file extension.

Running V code

Let’s kick things off by learning how to run V code. In order to do that we need a small source code file, which is going to contain the following code and is called hw.v:

module main

fn main() {

// Print the message println('Hello Linux Format!')

Before executing the code, we need a quick explanation. The previous code defines a function called main(), which when present is the entry point to a V program. The println() function is used for printing on screen. Additionally, V uses curly braces for defining blocks of code, including function implementations. Finally,

You’re reading a preview, subscribe to read more.

More from Linux Format

Linux Format2 min read
Licence To Kill
As I write this, the blogging universe is having a torrid time after two big names in the WordPress world (WP Engine and WordPress.org) have had a very major, very public fallout. The story boils down to (among other things) WP Engine refusing to con
Linux Format2 min read
Back Issues » Missed One?
November 2024 Product code: LXFDB0321 Build your own Linux fortress and protect your privacy with Qubes OS, and learn all about Matter, the new Internet of Things standard. Plus, discover which media server is best, find out how to secure your files,
Linux Format2 min read
Rclone
Version: 1.68.1 Web: https://rclone.org There’s no such thing as being too cautious when it comes to safeguarding data. Although a lot of people stress over using secure passwords and even encryption, not many bother with keeping secure copies of dat

Related Books & Audiobooks