Gitly
English
Русский
Español
日本語
中文
Português
Pricing
Log in
Register
vxx2
/
vlib
/
v
/
checker
/
tests
/
match_generic_case_err.vv
22
lines
·
19
sloc
·
228 bytes
·
b51dfcfe7db5f9176e5217dbf45ff10fe83f0dca
Raw
1
module main
2
3
import strconv
4
5
fn main() {
6
println(to_int('1'))
7
println(to_int(1))
8
}
9
10
fn to_int[T](v T) i64 {
11
return match typeof(v).name {
12
'string' {
13
strconv.atoi(v) or { 0 }
14
}
15
'int' {
16
v
17
}
18
else {
19
0
20
}
21
}
22
}
23