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 Cinteroperability, 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
Safety
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 functionarguments. 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
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
V supports 4 memory management options:[22][6][12]
Use of an optional garbage collection (GC), that can be disabled, for handling allocations, and is the default.
Variables are immutable by default and are defined using := and a value. Use the mutreserved word (keyword) to make them mutable. Mutable variables can be assigned to using =:[26]
x:=1muty:=2y=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
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.
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.
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.
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.
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}} ~~~~
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.
structPlace{aintbint}mutp:=Place{a:15b:25}println(p.a)// A dot is used to access struct fields// Alternative literal syntax can be usedp=Place{15,25}assertp.a==15
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.
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.
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.
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.
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]
structPlace{aintbint}p:=&Place{30,30}// References use the same syntax to access fieldsprintln(p.a)
Methods
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]
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.
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.
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.
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.
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}} ~~~~
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.
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.
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.
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.
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.
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]
fnsomething(tstring)!string{ift=="foo"{return"foo"}returnerror("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 tracebackprintln(x)println(y)