Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
aliases
/
alias_option_test.v
15
lines
·
12
sloc
·
236 bytes
·
87340bcca2aa7f7cb6b524d6573a08b52ed1401b
Raw
1
module
main
2
3
// Test option type alias
4
pub
type
MaybeInt = ?int
5
6
pub
fn
is_some(val MaybeInt) bool {
7
return
val !=
none
8
}
9
10
fn
test_alias_option() {
11
v := ?int(42)
12
result := is_some(v)
13
println(
'Has value: ${result}'
)
14
assert result
15
}
16