Jump to content

V (programming language)

From Simple English Wikipedia, the free encyclopedia
V
A capitalized letter V colored blue
The official V logo
Paradigmsfunctional, imperative, structured, concurrent
Designed byAlexander Medvednikov[1]
First appeared20 June 2019; 6 years ago (2019-06-20)
Stable release0.4.12[2] Edit this on Wikidata / 19 September 2025; 45 days ago (19 September 2025)
Typing disciplinestatic, strong, inferred
Implementation languageV
Platformx86-64
OSLinux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, DragonflyBSD, Solaris
LicenseMIT
Filename extensions.v, .vsh
Websitevlang.io
Influenced by
Go, Kotlin, Oberon, Python, Rust, Swift

V, also known as vlang, is a compiled programming language created to be easier for using, reading, maintaining, and making safer programs.[3][4] It was created by Alexander Medvednikov in 2019.[5]

Some technical details

[change | change source]

V is also general-purpose, which means that it can be used for different purposes, to include creating different kinds of applications that can be cross-platform.[5] V applications can be created to run on many different operating systems. The language also has various rules and features for greater program safety.[5][4]

Users don't have to care about managing memory themselves, unless they want to, because V gives different options. Users can use a garbage-collector (GC), which is 1 of 4 other choices.[6][7][8] Advanced users can choose to turn the GC off and manage memory themselves, using the other options from V.[5][8]

V works well with C. Functions in C can be called for use in V.[4] It can translate C code into V.[4] Code in V can also be compiled to human readable C, JavaScript, and other languages.[5][7]

Examples

[change | change source]

Here is a hello world program in V.

println("Hello world!")

Here is an example of using a variable:

  • Define by using := and a value.
  • Variables that don't have mut, have values that can't be changed.
  • Variables that have mut before them can change values using =.
a := 1 // value can not be changed
mut b := 2 // value can be changed
b = 3

Here is an example of using `if`, `else if` and `else` conditionals in V.

// Define entry point.
fn main() {
	a := 10
	b := 20
	if a < b {
		println("${a} < ${b}")
	} else if a > b {
		println("${a} > ${b}")
	} else {
		println("${a} == ${b}")
	}
	// Output: 10 < 20
}

Here are examples of how to use the for loop in V.

  • In V, all types of loops use the same `for` keyword.
  • This helps to make it easier to learn and separate them from other kinds of code.
// Define entry point.
fn main() {
    // Here is a condition `for` loop (also known as a `while` loop).
	mut count := 0
    for count < 5 {
        // some code
        count++
        println(count) // Prints numbers from 1 up to 5.
    }

    // Here is a range `for` loop.
    for i in 1..10 {
        println("Number: ${i}") // Prints numbers from 1 up to 9.
    }
	
    // Here is a map `for` loop.
	m := {
		"one": 1
		"two": 2
	}
	for key, value in m {
		println("${key} -> ${value}")
		// Output: one -> 1
		//         two -> 2
	}

	// Here is a bare `for` loop.
	mut num := 0
	for {
		num += 2
		if num >= 10 {
			break
		}
	}
	println(num) // Prints "10".
	
	// Here is a C style `for` loop.
	for i := 0; i < 8; i += 2 {
		// Don't print 4
		if i == 4 {
			continue
		}
		println(i) // Prints the numbers "0", "2", and "6".
	}
}

References

[change | change source]
  1. "Creator of V". GitHub.
  2. "Release 0.4.12". 19 September 2025. Retrieved 29 September 2025.
  3. Knott, Simon (27 June 2019). "An introduction to V". Retrieved 27 June 2019.
  4. 1 2 3 4 Nasufi, Erdet. "An introduction to V - the vlang". DebConf. Retrieved 24 July 2022.
  5. 1 2 3 4 5 Rao 2021.
  6. Tsoukalos 2022.
  7. 1 2 Chakraborty 2023.
  8. 1 2 Trex 2024.

Further reading

[change | change source]
  • The V Programming Language basic (in Japanese). Independent Laboratory. June 20, 2020. ASIN B08BKJDRFR.
  • Rao, Navule Pavan Kumar (December 10, 2021). Getting Started with V Programming. Packt Publishing. ISBN 978-1839213434. OCLC 1290492862.
  • Lyons, Dakota "Kai" (April 13, 2022). Beginning with V Programming. Independently Published. ISBN 979-8801499963.
  • Tsoukalos, Mihalis (May 2022). "Discover the V language". Linux Format Magazine (288). ISSN 1470-4234.
  • Chakraborty, Dr. Soubhik; Haldar, Subhomoy (December 6, 2023). Randomness Revisited using the V Programming Language. Nova Science Publishers. doi:10.52305/CVCN5241. ISBN 979-8891133280.
  • Trex, Nova (24 December 2024). V Programming: Building Robust and Efficient Software Systems. Wang Press. ISBN 979-8304813778.
  • Sanders, Rafael (18 September 2025). V Language for Beginners: How to Code with V for Fast, Simple, and Maintainable Software. Lincoln Publishers. ISBN 979-8263861681.
  • Sanders, Rafael (18 September 2025). V Language Intermediate Guide: How to Build Reliable Software with V’s Simple but Powerful Features. Lincoln Publishers. ISBN 979-8263865429.

Other websites

[change | change source]

Review Videos: