Bonjour V!
Tags: v, vprogramming, helloworld, firstpost
Published: 2020-03-01 10:57:19

> Let's meet the new kid on the programming block.


> *[V is a brand new programming language](https://vlang.io/) that's been making quite a few waves in the programming community.*

I stumbled upon it a few months back when I read [this](https://hub.packtpub.com/the-v-programming-language-is-now-open-sourced-is-it-too-good-to-be-true/) article.

While V is still in its infancy as of this writing (there are only **_[six](https://stackoverflow.com/questions/tagged/vlang)_** questions about it on [SO](https://stackoverflow.com/)), it is gaining popularity (it has around [**_15.9K_**](https://github.com/vlang/v/stargazers) stars on GitHub).

And it's also under active development (as evidenced by the recent commits in its [GitHub repo](https://github.com/vlang/v)).

So, I thought, why not give it a try. After all, what's the harm in being an early adopter, right?

So, let's get started!

#### Step 1. Install V on your local machine

> *You can install V using prebuilt binaries (such as [this one](https://github.com/vlang/v/releases/latest/download/v_macos.zip)), or you can directly [compile](https://github.com/vlang/v#installing-v-from-source) its [source code](https://github.com/vlang/v).*

Since I use a *MacBook Air (13-inch, 2007) running [macOS Catalina](https://www.apple.com/in/macos/catalina/) (version 10.15.3),* I downloaded [this](https://github.com/vlang/v/releases/latest/download/v_macos.zip) prebuilt binary for macOS.

I extracted its contents and fired up the [*macOS Terminal*](https://support.apple.com/en-in/guide/terminal/welcome/mac). Then, I navigated to the directory where I'd extracted the prebuilt binary and fired the following command in the Terminal:

> ### *`./v version`*

It's supposed to display V's current version, something like below:

> ### *`V 0.1.24 0d93eeb`*

But instead, the following prompt popped up on the screen:

![A warning prompt from macOS stating that macOS is unable to verify app (https://support.apple.com/en-us/HT202491)](https://cdn-images-1.medium.com/max/800/1*eNLfy-N3-IMSE2MwakIpXw.png)

You see, macOS blocks the execution of apps that haven't been *[notarized](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution) (meaning, apple can't verify the origins of the app, and as a result, can't guarantee that the application isn't malicious).*

So, what do we do now? Give up?

Absolutely not!

There's a workaround: We can tell macOS to make an exception for such *unnotarized* apps by navigating to *System Preferences > Security & Privacy* and click the "Allow Anyway" button. Take a peek at the *gif* below to get a better idea:

![](https://cdn-images-1.medium.com/max/1200/1*Ntf2yHJz0b3mRHdQGhLPrw.gif)

Now that we've told the bouncer (macOS 😀) to let the guest in, we should be able to start the party, right? (run V via the Terminal without any issue)

But no! 😯 That's not what happens. When we execute the `./v version` on the Terminal again, the following screen pops up:

![macOS blocks the execution of the app yet again, but this time, there's an "Open" button, which empowers the user to "run" it](https://cdn-images-1.medium.com/max/800/1*jc0Crk_9clQxQ10ZpfrKXA.png)

This is the same pop-up that we encountered a while back, but this time, macOS has provided us with the "Open" button. Let's click it and see what happens:

![V prints its version number on the Terminal](https://cdn-images-1.medium.com/max/1200/1*4Uoa6BdCy2xYR7KlQvi76w.png)

As soon as we click "Open", the `./v version` command executes and prints its output on the Terminal.

#### Step 2. Start writing code in V

> *Now that V's compiler is up & running on our local machine, we can start writing programs in V.*

But wait! Don't we need a fancy IDE like [*VSCode*](https://code.visualstudio.com/), with all its elegant themes and plugins 😄 (just joking, it's my favorite IDE.)

No, not yet, at least!

V provides a [*REPL*](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) interface that allows you to play around with the language without having to create any files on your hard disk.

So, as the [*Hello World Tradition*](https://en.wikipedia.org/wiki/%22Hello,_World!%22_program) dictates, let's write our first program in V:

> ### `print("Bonjour V!")`

Press the "enter/return" key on your keyboard and let the magic begin!

![The traditional "Hello world" program, or in this case "Bonjour V!" program written using V's REPL interface](https://cdn-images-1.medium.com/max/1200/1*X8pInVu4kosqqY4rgWYibw.png)

Voila! It worked!

That's it, guys!

Stay tuned for more stories about V programming!