V (programming language)

General-purpose programming language

The official V logo

Paradigms| Multi-paradigm: functional, imperative, structured, concurrent
Designed by| Alexander Medvednikov[1]
First appeared| 20 June 2019; 6 years ago (2019-06-20)[2]
Stable release|

0.4.11[3]  / June 19, 2025; 39 days ago (June 19, 2025)

Typing discipline| static, strong, inferred
Memory management| optional (automatic or manual)
Implementation language| V
Platform| x86-64
OS| Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, DragonflyBSD, Solaris
License| MIT
Filename extensions| `.v`, `.vsh`
Website| vlang.io
Influenced by
Go, Kotlin, Oberon, Python, Rust, Swift

V, also known as vlang, is a statically typed, compiled programming language created by Alexander Medvednikov in early 2019.[4] It was inspired by Go, and other programming languages including Oberon, Swift, and Rust.[5][6][7] It is free and open-source software released under the MIT License, and currently in beta.[8]

The goals of V include ease of use, readability, and maintainability.[9][10][11]

## History

[edit]

The new language was created as a result of frustration with existing languages being used for personal projects.[12] It was originally intended for personal use, but after being mentioned publicly and increasing interest, it was decided to make it public. V was initially created to develop a desktop messaging client named Volt.[6] On public release, the compiler was written in V, and could compile itself.[4][12] Key design goals in creating V were being easy to learn and use, higher readability, fast compiling, increased safety, efficient development, cross-platform usability, improved C interoperability, better error handling, modern features, and more maintainable software.[13][14][10][15]

V is released and developed through GitHub,[16][6] and maintained by developers and contributors internationally.[4] It is among the languages that have been listed on the TIOBE index.[17]

Veasel is the official mascot of the V programming language[18]

## Features

[edit]

### Safety

[edit]

V has policies to facilitate memory-safety, speed, and secure code,[13][19][6] including various default features for greater program safety.[7][13][12] It employs bounds checking, to guard against out of bounds use of variables. Option/result types are used, where the option data type (`?`) can be represented by `none` (among possible choices) and the result type (`!`) can handle any returned errors. To ensure greater safety, error checking is mandatory. By default, the following are immutable: variables, structs, and function arguments. This includes string values are immutable, so elements cannot be mutated. Other protections, which are the default for the language, are: no use of undefined values, variable shadowing, null pointers (unless marked as unsafe), or global variables (unless enabled via flag).

### Performance

[edit]

V uses value types and string buffers to reduce memory allocations.[20][21][13] The language can be compiled to human-readable C,[7][4] and in terms of execution and compilation, it's considered to be as performant.[13][14][12]

### Memory management

[edit]

V supports 4 memory management options:[22][6][12]

1. Use of an optional garbage collection (GC), that can be disabled, for handling allocations, and is the default.
2. Manual memory management via disabling the GC (`-gc none`).
3. Autofree, which handles most objects via free call insertion, and then the remaining percentage is freed by GC (`-autofree`).
4. Arena allocation (`-prealloc`).

### Source code translators

[edit]

V supports a source-to-source compiler (transpiler) and can translate C code into V.[14][23][10]

Working translators are also being developed for Go, JavaScript, and WebAssembly.[24][25][4]

## Syntax

[edit]

### Hello world

[edit]

The "Hello, World!" program in V:[13]

fn main() {
println("Hello, World!")

### Variables

[edit]

Variables are immutable by default and are defined using `:=` and a value. Use the `mut` reserved word (keyword) to make them mutable. Mutable variables can be assigned to using `=`:[26]

x := 1
mut y := 2
y = 3

Redeclaring a variable, whether in an inner scope or in the same scope, is not allowed:[26]

x := 1

x := 3 // error: redefinition of x

x := 2 // error: redefinition of x

### Structs

[edit]

An editor has launched a copyright investigation involving this section. The text under investigation is currently hidden from public view, but is accessible in the page history. Please do not remove this notice or restore blanked content until the issue is resolved by an administrator, copyright clerk, or volunteer response agent.

The purported copyright violation copies text from https://docs.vlang.io/structs.html (Copyvios report); as such, this page has been listed on the copyright problems page.

Unless the copyright status of the text of this page or section is clarified and determined to be compatible with Wikipedia's content license, the problematic text and revisions or the entire page may be deleted one week after the time of its listing (i.e. after 16:45, 22 July 2025 (UTC)).

What can I do to resolve the issue?

* * *

* If you hold the copyright to this text, you can license it in a manner that allows its use on Wikipedia.
1. You must permit the use of your material under the terms of the Creative Commons Attribution-Sharealike 4.0 International License (CC BY-SA 4.0) and the GNU Free Documentation License (GFDL) (unversioned, with no invariant sections, front-cover texts, or back-cover texts).
2. Explain your intent to license the content on this article's discussion page.
3. To confirm your permission, you can either display a notice to this effect at the site of original publication or send an e-mail from an address associated with the original publication to permissions-enwikimedia.org or a postal letter to the Wikimedia Foundation. These messages must explicitly permit use under CC BY-SA and the GFDL. See Wikipedia:Donating copyrighted materials.
4. Note that articles on Wikipedia must be written from a neutral point of view and must be verifiable in published third-party sources; consider whether, copyright issues aside, your text is appropriate for inclusion in Wikipedia.
* You can demonstrate that this text is in the public domain or is already under a license suitable for Wikipedia. Explain this on this article's discussion page, with reference to evidence. Wikipedia:Public domain and Wikipedia:Compatibly licensed may assist in determining the status.
* Otherwise, you may rewrite this page without copyright-infringing material. Your rewrite should be placed on this page, where it will be available for an administrator or clerk to review it at the end of the listing period. Follow this link to create the temporary subpage. Please mention the rewrite upon completion on this article's discussion page.
* Simply modifying copyrighted text is not sufficient to avoid copyright infringement—if the original copyright violation cannot be cleanly removed or the article reverted to a prior version, it is best to write the article from scratch. (See Wikipedia:Close paraphrasing.)
* For license compliance, any content used from the original article must be properly attributed; if you use content from the original, please leave a note at the top of your rewrite saying as much. You may duplicate non-infringing text that you had contributed yourself.
* It is always a good idea, if rewriting, to identify the point where the copyrighted content was imported to Wikipedia and to check to make sure that the contributor did not add content imported from other sources. When closing investigations, clerks and administrators may find other copyright problems than the one identified. If this material is in the proposed rewrite and cannot be easily removed, the rewrite may not be usable.

* * *

Steps to list an article at Wikipedia:Copyright problems:

1. Add the following to the bottom of Wikipedia:Copyright problems/2025 July 15: `* {{subst:article-cv|V (programming language)}} from https://docs.vlang.io/structs.html. ~~~~`
2. Add the following template to the talk page of the contributor of the material: `{{subst:Nothanks-web|pg=V (programming language)|url=https://docs.vlang.io/structs.html}} ~~~~`
3. Place {{copyvio/bottom}} at the end of the portion you want to blank. If nominating the entire page, please place this template at the top of the page, set the "fullpage" parameter to "yes", and place {{copyvio/bottom}} at the very end of the article.

|

Struct example:[9][7]

struct Place {
a int
b int

mut p := Place {
a: 15
b: 25

println(p.a) // A dot is used to access struct fields
// Alternative literal syntax can be used
p = Place{15, 25}
assert p.a == 15

### Heap structs

[edit]

An editor has launched a copyright investigation involving this section. The text under investigation is currently hidden from public view, but is accessible in the page history. Please do not remove this notice or restore blanked content until the issue is resolved by an administrator, copyright clerk, or volunteer response agent.

The purported copyright violation copies text from https://docs.vlang.io/structs.html#heap-structs (Copyvios report); as such, this page has been listed on the copyright problems page.

Unless the copyright status of the text of this page or section is clarified and determined to be compatible with Wikipedia's content license, the problematic text and revisions or the entire page may be deleted one week after the time of its listing (i.e. after 16:45, 22 July 2025 (UTC)).

What can I do to resolve the issue?

* * *

* If you hold the copyright to this text, you can license it in a manner that allows its use on Wikipedia.
1. You must permit the use of your material under the terms of the Creative Commons Attribution-Sharealike 4.0 International License (CC BY-SA 4.0) and the GNU Free Documentation License (GFDL) (unversioned, with no invariant sections, front-cover texts, or back-cover texts).
2. Explain your intent to license the content on this article's discussion page.
3. To confirm your permission, you can either display a notice to this effect at the site of original publication or send an e-mail from an address associated with the original publication to permissions-enwikimedia.org or a postal letter to the Wikimedia Foundation. These messages must explicitly permit use under CC BY-SA and the GFDL. See Wikipedia:Donating copyrighted materials.
4. Note that articles on Wikipedia must be written from a neutral point of view and must be verifiable in published third-party sources; consider whether, copyright issues aside, your text is appropriate for inclusion in Wikipedia.
* You can demonstrate that this text is in the public domain or is already under a license suitable for Wikipedia. Explain this on this article's discussion page, with reference to evidence. Wikipedia:Public domain and Wikipedia:Compatibly licensed may assist in determining the status.
* Otherwise, you may rewrite this page without copyright-infringing material. Your rewrite should be placed on this page, where it will be available for an administrator or clerk to review it at the end of the listing period. Follow this link to create the temporary subpage. Please mention the rewrite upon completion on this article's discussion page.
* Simply modifying copyrighted text is not sufficient to avoid copyright infringement—if the original copyright violation cannot be cleanly removed or the article reverted to a prior version, it is best to write the article from scratch. (See Wikipedia:Close paraphrasing.)
* For license compliance, any content used from the original article must be properly attributed; if you use content from the original, please leave a note at the top of your rewrite saying as much. You may duplicate non-infringing text that you had contributed yourself.
* It is always a good idea, if rewriting, to identify the point where the copyrighted content was imported to Wikipedia and to check to make sure that the contributor did not add content imported from other sources. When closing investigations, clerks and administrators may find other copyright problems than the one identified. If this material is in the proposed rewrite and cannot be easily removed, the rewrite may not be usable.

* * *

Steps to list an article at Wikipedia:Copyright problems:

1. Add the following to the bottom of Wikipedia:Copyright problems/2025 July 15: `* {{subst:article-cv|V (programming language)}} from https://docs.vlang.io/structs.html#heap-structs. ~~~~`
2. Add the following template to the talk page of the contributor of the material: `{{subst:Nothanks-web|pg=V (programming language)|url=https://docs.vlang.io/structs.html#heap-structs}} ~~~~`
3. Place {{copyvio/bottom}} at the end of the portion you want to blank. If nominating the entire page, please place this template at the top of the page, set the "fullpage" parameter to "yes", and place {{copyvio/bottom}} at the very end of the article.

|

Structs are allocated on the stack by default. The `&` prefix can be used, for getting a reference to it and allocating on the heap instead:[4]

struct Place {
a int
b int

p := &Place{30, 30}
// References use the same syntax to access fields
println(p.a)

### Methods

[edit]

Methods in V are functions defined with a receiver argument. The receiver appears in its own argument list between the fn keyword and the method name. Methods must be in the same module as the receiver type.

The is_registered method has a receiver of type User named u. The convention is not to use receiver names like self or this, but preferably a short name. For example:[9][10]

An editor has launched a copyright investigation involving this section. The text under investigation is currently hidden from public view, but is accessible in the page history. Please do not remove this notice or restore blanked content until the issue is resolved by an administrator, copyright clerk, or volunteer response agent.

The purported copyright violation copies text from https://docs.vlang.io/structs.html#methods (Copyvios report); as such, this page has been listed on the copyright problems page.

Unless the copyright status of the text of this page or section is clarified and determined to be compatible with Wikipedia's content license, the problematic text and revisions or the entire page may be deleted one week after the time of its listing (i.e. after 16:45, 22 July 2025 (UTC)).

What can I do to resolve the issue?

* * *

* If you hold the copyright to this text, you can license it in a manner that allows its use on Wikipedia.
1. You must permit the use of your material under the terms of the Creative Commons Attribution-Sharealike 4.0 International License (CC BY-SA 4.0) and the GNU Free Documentation License (GFDL) (unversioned, with no invariant sections, front-cover texts, or back-cover texts).
2. Explain your intent to license the content on this article's discussion page.
3. To confirm your permission, you can either display a notice to this effect at the site of original publication or send an e-mail from an address associated with the original publication to permissions-enwikimedia.org or a postal letter to the Wikimedia Foundation. These messages must explicitly permit use under CC BY-SA and the GFDL. See Wikipedia:Donating copyrighted materials.
4. Note that articles on Wikipedia must be written from a neutral point of view and must be verifiable in published third-party sources; consider whether, copyright issues aside, your text is appropriate for inclusion in Wikipedia.
* You can demonstrate that this text is in the public domain or is already under a license suitable for Wikipedia. Explain this on this article's discussion page, with reference to evidence. Wikipedia:Public domain and Wikipedia:Compatibly licensed may assist in determining the status.
* Otherwise, you may rewrite this page without copyright-infringing material. Your rewrite should be placed on this page, where it will be available for an administrator or clerk to review it at the end of the listing period. Follow this link to create the temporary subpage. Please mention the rewrite upon completion on this article's discussion page.
* Simply modifying copyrighted text is not sufficient to avoid copyright infringement—if the original copyright violation cannot be cleanly removed or the article reverted to a prior version, it is best to write the article from scratch. (See Wikipedia:Close paraphrasing.)
* For license compliance, any content used from the original article must be properly attributed; if you use content from the original, please leave a note at the top of your rewrite saying as much. You may duplicate non-infringing text that you had contributed yourself.
* It is always a good idea, if rewriting, to identify the point where the copyrighted content was imported to Wikipedia and to check to make sure that the contributor did not add content imported from other sources. When closing investigations, clerks and administrators may find other copyright problems than the one identified. If this material is in the proposed rewrite and cannot be easily removed, the rewrite may not be usable.

* * *

Steps to list an article at Wikipedia:Copyright problems:

1. Add the following to the bottom of Wikipedia:Copyright problems/2025 July 15: `* {{subst:article-cv|V (programming language)}} from https://docs.vlang.io/structs.html#methods. ~~~~`
2. Add the following template to the talk page of the contributor of the material: `{{subst:Nothanks-web|pg=V (programming language)|url=https://docs.vlang.io/structs.html#methods}} ~~~~`
3. Place {{copyvio/bottom}} at the end of the portion you want to blank. If nominating the entire page, please place this template at the top of the page, set the "fullpage" parameter to "yes", and place {{copyvio/bottom}} at the very end of the article.

|

struct User {
age int

fn (u User) is_registered() bool {
return u.age > 16

user := User{
age: 10

println(user.is_registered()) // "false"

user2 := User{
age: 20

println(user2.is_registered()) // "true"

### Error handling

[edit]

An editor has launched a copyright investigation involving this section. The text under investigation is currently hidden from public view, but is accessible in the page history. Please do not remove this notice or restore blanked content until the issue is resolved by an administrator, copyright clerk, or volunteer response agent.

The purported copyright violation copies text from https://docs.vlang.io/type-declarations.html#optionresult-types-and-error-handling (Copyvios report); as such, this page has been listed on the copyright problems page.

Unless the copyright status of the text of this page or section is clarified and determined to be compatible with Wikipedia's content license, the problematic text and revisions or the entire page may be deleted one week after the time of its listing (i.e. after 16:45, 22 July 2025 (UTC)).

What can I do to resolve the issue?

* * *

* If you hold the copyright to this text, you can license it in a manner that allows its use on Wikipedia.
1. You must permit the use of your material under the terms of the Creative Commons Attribution-Sharealike 4.0 International License (CC BY-SA 4.0) and the GNU Free Documentation License (GFDL) (unversioned, with no invariant sections, front-cover texts, or back-cover texts).
2. Explain your intent to license the content on this article's discussion page.
3. To confirm your permission, you can either display a notice to this effect at the site of original publication or send an e-mail from an address associated with the original publication to permissions-enwikimedia.org or a postal letter to the Wikimedia Foundation. These messages must explicitly permit use under CC BY-SA and the GFDL. See Wikipedia:Donating copyrighted materials.
4. Note that articles on Wikipedia must be written from a neutral point of view and must be verifiable in published third-party sources; consider whether, copyright issues aside, your text is appropriate for inclusion in Wikipedia.
* You can demonstrate that this text is in the public domain or is already under a license suitable for Wikipedia. Explain this on this article's discussion page, with reference to evidence. Wikipedia:Public domain and Wikipedia:Compatibly licensed may assist in determining the status.
* Otherwise, you may rewrite this page without copyright-infringing material. Your rewrite should be placed on this page, where it will be available for an administrator or clerk to review it at the end of the listing period. Follow this link to create the temporary subpage. Please mention the rewrite upon completion on this article's discussion page.
* Simply modifying copyrighted text is not sufficient to avoid copyright infringement—if the original copyright violation cannot be cleanly removed or the article reverted to a prior version, it is best to write the article from scratch. (See Wikipedia:Close paraphrasing.)
* For license compliance, any content used from the original article must be properly attributed; if you use content from the original, please leave a note at the top of your rewrite saying as much. You may duplicate non-infringing text that you had contributed yourself.
* It is always a good idea, if rewriting, to identify the point where the copyrighted content was imported to Wikipedia and to check to make sure that the contributor did not add content imported from other sources. When closing investigations, clerks and administrators may find other copyright problems than the one identified. If this material is in the proposed rewrite and cannot be easily removed, the rewrite may not be usable.

* * *

Steps to list an article at Wikipedia:Copyright problems:

1. Add the following to the bottom of Wikipedia:Copyright problems/2025 July 15: `* {{subst:article-cv|V (programming language)}} from https://docs.vlang.io/type-declarations.html#optionresult-types-and-error-handling. ~~~~`
2. Add the following template to the talk page of the contributor of the material: `{{subst:Nothanks-web|pg=V (programming language)|url=https://docs.vlang.io/type-declarations.html#optionresult-types-and-error-handling}} ~~~~`
3. Place {{copyvio/bottom}} at the end of the portion you want to blank. If nominating the entire page, please place this template at the top of the page, set the "fullpage" parameter to "yes", and place {{copyvio/bottom}} at the very end of the article.

|

Optional types are for types which may represent none. Result types may represent an error returned from a function.

Option types are declared by prepending `?` to the type name: `?Type`. Result types use `!`: `!Type`.[9][7][22]

fn something(t string) !string {
if t == "foo" { return "foo" }
return error("invalid string")

x := something("foo") or { "default" } // x will be "foo"
y := something("car") or { "default" } // y will be "default"
z := something("car") or { panic("{err}") } // will exit with error "invalid string" and a traceback

println(x)
println(y)

## See also

[edit]

* Free and open-source software portal
* Computer programming portal

* Comparison of programming languages
* History of programming languages
* List of programming languages
* List of programming languages by type

## References

[edit]

1. ^ "Creator of V". GitHub.
2. ^ "First public release". GitHub. 20 June 2019.
3. ^ "Release 0.4.11". 19 June 2025. Retrieved 20 June 2025.
4. ^ a b c d e f Rao 2021.
5. ^ Lewkowicz, Jakub (25 June 2019). "SD Times news digest: V language now open sourced". SD Times. SD Times. Retrieved 25 June 2019.
6. ^ a b c d e James, Ben (23 July 2019). "The V Programming Language: Vain Or Virtuous?". Hackaday. Hackaday. Retrieved 23 July 2019.
7. ^ a b c d e Umoren, Samuel. "Building a Web Server using Vlang". Section. Archived from the original on 13 March 2023. Retrieved 5 April 2021.
8. ^ "The V Programming Language". vlang.io. Retrieved 4 November 2023.
9. ^ a b c d Knott, Simon (27 June 2019). "An introduction to V". Retrieved 27 June 2019.
10. ^ a b c d Nasufi, Erdet. "An introduction to V - the vlang". Debian Conference (DebConf). Retrieved 24 July 2022.
11. ^ Sharma, Gaurav (19 March 2024). "Exploring the newest programming languages for developers in 2024". TechGig. TechGig.com.
12. ^ a b c d e Chakraborty & Haldar 2023.
13. ^ a b c d e f Galuh, Rosa (8 August 2022). "A Brief Introduction to the V Language". MakeUseOf (MUO). Valnet. Retrieved 8 August 2022.
14. ^ a b c Choudhury, Ambika (9 February 2022). "Meet V, The New Statically Typed Programming Language Inspired By Go & Rust". Analytics India Magazine (AIM). Retrieved 7 July 2024.
15. ^ "V language: simple like Go, small binary like Rust". TechRacho. Retrieved 3 March 2021.
16. ^ "GitHub Programming Languages (repository details)" – via OSS Insight using TiDB.[permanent dead link]
17. ^ "TIOBE Index". tiobe. TIOBE. Archived from the original on 11 April 2025. Retrieved 11 April 2025.
18. ^ "V's official mascot". GitHub. Retrieved 8 November 2023.
19. ^ Abbas, Hazem (5 August 2024). "Introduction to V Language and Desktop App Development". medevel. Retrieved 3 January 2025.
20. ^ Rao 2021, p. 7.
21. ^ "The V programming language is now open source". Packt Hub. Packt Publishing. 24 June 2019. Retrieved 24 June 2019.
22. ^ a b Tsoukalos 2022.
23. ^ Schlothauer, Sarah. "The trendy five: Blazing hot GitHub repos in June 2019". JAXenter. Archived from the original on 17 February 2020. Retrieved 1 July 2019.
24. ^ "Convert Go to V with go2v". Zenn. 26 January 2023. Retrieved 26 January 2023.
25. ^ "The V WebAssembly Compiler Backend". l-m. 26 February 2023. Archived from the original on 8 July 2024.
26. ^ a b Rao 2021, pp. 28–40.

## Further reading

[edit]

* The V Programming Language basic (in Japanese). Independent Laboratory. 20 June 2020. ASIN B08BKJDRFR.
* Rao, Navule Pavan Kumar (10 December 2021). Getting Started with V Programming. Packt Publishing. ISBN 978-1839213434. OCLC 1290492862.
* Lyons, Dakota "Kai" (13 April 2022). Beginning with V Programming. Independently Published. ISBN 979-8801499963.
* Tsoukalos, Mihalis (May 2022). "Discover the V language". Linux Format Magazine (288). Linux Format. ISSN 1470-4234.
* Chakraborty, Soubhik; Haldar, Subhomoy (6 December 2023). Randomness Revisited using the V Programming Language. Nova Science Publishers. doi:10.52305/CVCN5241. ISBN 979-8891133280. S2CID 265170755.
* Trex, Nova (24 December 2024). V Programming: Building Robust and Efficient Software Systems. Wang Press. ISBN 979-8304813778.

## External links

[edit]

* Official website
* Vlang on GitHub
* Documentation
* Modules
* Video: How To Maintain And Iterate With V (Sydney Computing Society)
* Video: A small presentation of V's features at IBM