Jump to content

V (programming language)

From Simple English Wikipedia, the free encyclopedia
Revision as of 17:17, 10 January 2024 by Wukuendo (talk | changes) (Create simple version of V programming language.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
V
A capitalized letter V colored blue
The official V logo
ParadigmsMulti-paradigm: functional, imperative, structured, concurrent
Designed byAlexander Medvednikov[1]
Stable release0.4.12[2] Edit this on Wikidata / September 19, 2025; 50 days ago (September 19, 2025)
Typing disciplinestatic, strong, infered
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 statically typed compiled programming language designed for ease of use, readability, and maintainability.[3][4] It was created by Alexander Medvednikov in 2019.[5]

Examples

Here is a hello world program in V.

fn main() {
	println('Hello, World!')
}

Here is an example of how to declare a variable.

  • Variables are immutable by default.
  • Define by using := and a value.
  • Use the mut keyword to make them mutable.
  • Mutable variables can be assigned to using =.
a := 1
mut b := 2
b = 3

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

fn main() {
	a := 10
	b := 20
	if a < b {
		println('${a} < ${b}')
	} else if a > b {
		println('${a} > ${b}')
	} else {
		println('${a} == ${b}')
	}
}

Here is an example of using loops in V.

// Define entry point.
fn main() {
    mut count := 0

    // Here is a condition `for` loop (also known as a `while` loop).
    for count < 5 {
        // some code
        count++
        println(count)
    }

    // Here is a range `for` loop.
    for i in 1..10 {
        println("${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
	}
}

References

  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. Nasufi, Erdet. "An introduction to V - the vlang". DebConf. Retrieved 24 July 2022.
  5. Rao, Navule Pavan Kumar (December 10, 2021). Getting Started with V Programming. Packt Publishing. ISBN 978-1839213434. OCLC 1290492862.