Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
conditions
/
ifs
/
if_assign_test.v
15
lines
·
14
sloc
·
186 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
struct
Foo {
2
mut
:
3
option ?string
4
}
5
6
fn
test_main() {
7
mut
foo := Foo{}
8
some_val := 1
9
foo.option =
if
some_val > 0 {
10
'awesome'
11
}
else
{
12
none
13
}
14
assert foo.option? ==
'awesome'
15
}
16