vig/examples/hello.v

93 lines
863 B
Coq
Raw Normal View History

2019-08-24 19:56:58 +00:00
const (
Cock = 1
Ball = 2 + 3
Deals = 3
Businesses = 4
)
2019-08-26 16:15:08 +00:00
struct Point {
x int
y int
}
2019-08-24 14:07:23 +00:00
fn main(a int) int {
2019-08-24 14:15:41 +00:00
1 + 2 + 3 + 4
1 + 1 * 1
3 / (51 + 2)
mut a := 1+2
a = 2
2019-08-25 16:02:40 +00:00
2019-12-07 22:45:12 +00:00
a = 1 && 0
2019-08-25 16:02:40 +00:00
if a {
println(30)
} else {
println(50)
}
2019-08-25 16:21:22 +00:00
2019-08-26 14:59:32 +00:00
2019-08-25 16:21:22 +00:00
a && b
a || b
2019-08-25 20:14:25 +00:00
loop {}
loop {
println('Ballse')
}
loop a > 2 {}
loop a > 2 {
println('skirts')
}
2019-08-26 01:41:25 +00:00
2019-08-26 17:30:13 +00:00
test('asd', 1, 2, 3)
2019-08-26 02:16:13 +00:00
return 23
2019-08-26 12:54:01 +00:00
2019-08-26 14:59:32 +00:00
p := Point.{
x: 10
y: 20
}
2019-08-26 16:29:45 +00:00
p.x = 69
2019-08-26 17:30:13 +00:00
println(a.b(3).c(d))
2019-08-26 18:29:59 +00:00
v()()()
2019-08-27 00:57:01 +00:00
str := 'hello'
len := str.len
// those should yield the same ast
2019-08-27 00:57:01 +00:00
str.len = str.len + 1
str.len += 1
str.len -= 1
str.len *= 1
2019-08-27 14:58:32 +00:00
str.len /= 1
2019-08-27 15:19:10 +00:00
awoo := [1, 2, a(), b + 2, c(31) * d]
2019-08-29 17:30:33 +00:00
for a in b {}
for idx, a in b {}
2019-08-24 14:07:23 +00:00
}
2019-08-26 23:23:11 +00:00
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
}
2019-08-27 15:31:02 +00:00
enum Color {
red green blue
cyan
alpha
}