1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: document if as

This commit is contained in:
Alexander Medvednikov 2022-07-06 12:41:36 +03:00 committed by GitHub
parent 6a567a0dd6
commit 00dfce655e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1499,6 +1499,10 @@ if x.bar is MyStruct {
// x.bar is automatically casted // x.bar is automatically casted
println(x.bar) println(x.bar)
} }
else if x.bar is MyStruct2 as new_var {
// you can use `as` to create aliases
println(new_var)
}
match x.bar { match x.bar {
MyStruct { MyStruct {
// x.bar is automatically casted // x.bar is automatically casted