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

doc: fix a few typos (#18379)

This commit is contained in:
Antonio 2023-06-10 23:53:18 +02:00 committed by GitHub
parent 54cc59d3a5
commit c4a20f0992
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -515,7 +515,7 @@ respectively, when their type has to be decided:
u := u16(12) u := u16(12)
v := 13 + u // v is of type `u16` - no promotion v := 13 + u // v is of type `u16` - no promotion
x := f32(45.6) x := f32(45.6)
y := x + 3.14 // x is of type `f32` - no promotion y := x + 3.14 // y is of type `f32` - no promotion
a := 75 // a is of type `int` - default for int literal a := 75 // a is of type `int` - default for int literal
b := 14.7 // b is of type `f64` - default for float literal b := 14.7 // b is of type `f64` - default for float literal
c := u + a // c is of type `int` - automatic promotion of `u`'s value c := u + a // c is of type `int` - automatic promotion of `u`'s value
@ -1600,7 +1600,7 @@ type Alphabet = Abc | Xyz
x := Alphabet(Abc{'test'}) // sum type x := Alphabet(Abc{'test'}) // sum type
if x is Abc { if x is Abc {
// x is automatically casted to Abc and can be used here // x is automatically cast to Abc and can be used here
println(x) println(x)
} }
if x !is Abc { if x !is Abc {
@ -1613,11 +1613,11 @@ or using `match`:
```v oksyntax ```v oksyntax
match x { match x {
Abc { Abc {
// x is automatically casted to Abc and can be used here // x is automatically cast to Abc and can be used here
println(x) println(x)
} }
Xyz { Xyz {
// x is automatically casted to Xyz and can be used here // x is automatically cast to Xyz and can be used here
println(x) println(x)
} }
} }
@ -1644,7 +1644,7 @@ x := Abc{
bar: MyStruct{123} // MyStruct will be converted to MySumType type automatically bar: MyStruct{123} // MyStruct will be converted to MySumType type automatically
} }
if x.bar is MyStruct { if x.bar is MyStruct {
// x.bar is automatically casted // x.bar is automatically cast
println(x.bar) println(x.bar)
} else if x.bar is MyStruct2 { } else if x.bar is MyStruct2 {
new_var := x.bar as MyStruct2 new_var := x.bar as MyStruct2
@ -1653,7 +1653,7 @@ if x.bar is MyStruct {
} }
match x.bar { match x.bar {
MyStruct { MyStruct {
// x.bar is automatically casted // x.bar is automatically cast
println(x.bar) println(x.bar)
} }
else {} else {}
@ -1670,14 +1670,14 @@ It works like this:
```v oksyntax ```v oksyntax
mut x := MySumType(MyStruct{123}) mut x := MySumType(MyStruct{123})
if mut x is MyStruct { if mut x is MyStruct {
// x is casted to MyStruct even if it's mutable // x is cast to MyStruct even if it's mutable
// without the mut keyword that wouldn't work // without the mut keyword that wouldn't work
println(x) println(x)
} }
// same with match // same with match
match mut x { match mut x {
MyStruct { MyStruct {
// x is casted to MyStruct even if it's mutable // x is cast to MyStruct even if it's mutable
// without the mut keyword that wouldn't work // without the mut keyword that wouldn't work
println(x) println(x)
} }