vig/examples/hello.v

93 lines
863 B
V

const (
Cock = 1
Ball = 2 + 3
Deals = 3
Businesses = 4
)
struct Point {
x int
y int
}
fn main(a int) int {
1 + 2 + 3 + 4
1 + 1 * 1
3 / (51 + 2)
mut a := 1+2
a = 2
a = 1 && 0
if a {
println(30)
} else {
println(50)
}
a && b
a || b
loop {}
loop {
println('Ballse')
}
loop a > 2 {}
loop a > 2 {
println('skirts')
}
test('asd', 1, 2, 3)
return 23
p := Point.{
x: 10
y: 20
}
p.x = 69
println(a.b(3).c(d))
v()()()
str := 'hello'
len := str.len
// those should yield the same ast
str.len = str.len + 1
str.len += 1
str.len -= 1
str.len *= 1
str.len /= 1
awoo := [1, 2, a(), b + 2, c(31) * d]
for a in b {}
for idx, a in b {}
}
fn (v Typ) voidfunc() {}
struct Foo {
a int
mut:
b int
c int
pub:
d int
pub mut:
e int
pub mut mut:
f int
}
enum Color {
red green blue
cyan
alpha
}