V
V
Installation
git
git clone https://github.com/vlang/v
cd v
make
ln -s /path/to/v/v /usr/local/bin/v
Examples
Fibonacci Numbers
// Fibonacci Numbers
import os
fn fib(n int) int {
if n < 2 {
return n
} else {
return fib(n - 2) + fib(n - 1)
}
}
fn main() {
n := os.args[1].int()
println(fib(n))
}
/*
example
script:
v run fib.v 10
compile:
v fib.v
run:
./fib 39
*/