Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
comptime
/
comptime_if_assign_test.v
13
lines
·
12
sloc
·
157 bytes
·
b9e9192b2b229c82b097911e2f64ea420a1c6c68
Raw
1
fn
ret[T](str string) !T {
2
val := $
if
T is i8 {
3
T(123)
4
} $
else
{
5
T(123)
6
}
7
return
val
8
}
9
10
fn
test_main() {
11
x := ret[f32](
'1.0'
)!
12
assert x == 123.0
13
}
14