docs: fix some typos (#12341)
parent
6937074e7a
commit
28cada3fd5
16
doc/docs.md
16
doc/docs.md
|
@ -499,8 +499,8 @@ s[0] = `H` // not allowed
|
||||||
```
|
```
|
||||||
> error: cannot assign to `s[i]` since V strings are immutable
|
> error: cannot assign to `s[i]` since V strings are immutable
|
||||||
|
|
||||||
Note that indexing a string will produce a `byte`, not a `rune` nor another `string`.
|
Note that indexing a string will produce a `byte`, not a `rune` nor another `string`.
|
||||||
Indexes correspond to bytes in the string, not Unicode code points. If you want to
|
Indexes correspond to bytes in the string, not Unicode code points. If you want to
|
||||||
convert the `byte` to a `string`, use the `ascii_str()` method:
|
convert the `byte` to a `string`, use the `ascii_str()` method:
|
||||||
|
|
||||||
```v
|
```v
|
||||||
|
@ -1899,7 +1899,7 @@ new_button(ButtonConfig{text:'Click me', width:100})
|
||||||
This only works for functions that take a struct for the last argument.
|
This only works for functions that take a struct for the last argument.
|
||||||
|
|
||||||
NB: the `[params]` tag is used to tell V, that the trailing struct parameter
|
NB: the `[params]` tag is used to tell V, that the trailing struct parameter
|
||||||
can be ommited *entirely*, so that you can write `button := new_button()`.
|
can be omitted *entirely*, so that you can write `button := new_button()`.
|
||||||
Without it, you have to specify *at least* one of the field names, even if it
|
Without it, you have to specify *at least* one of the field names, even if it
|
||||||
has its default value, otherwise the compiler will produce this error message,
|
has its default value, otherwise the compiler will produce this error message,
|
||||||
when you call the function with no parameters:
|
when you call the function with no parameters:
|
||||||
|
@ -2783,7 +2783,7 @@ println('Grocery IDs: $g1, $g2, $g3')
|
||||||
|
|
||||||
Output: `Grocery IDs: 0, 5, 6`.
|
Output: `Grocery IDs: 0, 5, 6`.
|
||||||
|
|
||||||
Operations are not allowed on enum variables; they must be explicity cast to `int`.
|
Operations are not allowed on enum variables; they must be explicitly cast to `int`.
|
||||||
|
|
||||||
### Sum types
|
### Sum types
|
||||||
|
|
||||||
|
@ -4691,7 +4691,7 @@ If no flags are passed it will add `--cflags` and `--libs`, both lines below do
|
||||||
The `.pc` files are looked up into a hardcoded list of default pkg-config paths, the user can add
|
The `.pc` files are looked up into a hardcoded list of default pkg-config paths, the user can add
|
||||||
extra paths by using the `PKG_CONFIG_PATH` environment variable. Multiple modules can be passed.
|
extra paths by using the `PKG_CONFIG_PATH` environment variable. Multiple modules can be passed.
|
||||||
|
|
||||||
To check the existance of a pkg-config use `$pkgconfig('pkg')` as a compile time "if" condition to
|
To check the existence of a pkg-config use `$pkgconfig('pkg')` as a compile time "if" condition to
|
||||||
check if a pkg-config exists. If it exists the branch will be created. Use `$else` or `$else $if`
|
check if a pkg-config exists. If it exists the branch will be created. Use `$else` or `$else $if`
|
||||||
to handle other cases.
|
to handle other cases.
|
||||||
|
|
||||||
|
@ -5140,7 +5140,7 @@ but may impact the size of your executable.
|
||||||
|
|
||||||
`[direct_array_access]` - in functions tagged with `[direct_array_access]`
|
`[direct_array_access]` - in functions tagged with `[direct_array_access]`
|
||||||
the compiler will translate array operations directly into C array operations -
|
the compiler will translate array operations directly into C array operations -
|
||||||
omiting bounds checking. This may save a lot of time in a function that iterates
|
omitting bounds checking. This may save a lot of time in a function that iterates
|
||||||
over an array but at the cost of making the function unsafe - unless
|
over an array but at the cost of making the function unsafe - unless
|
||||||
the boundaries will be checked by the user.
|
the boundaries will be checked by the user.
|
||||||
|
|
||||||
|
@ -5220,7 +5220,7 @@ operator overloading is an important feature to have in order to improve readabi
|
||||||
To improve safety and maintainability, operator overloading is limited:
|
To improve safety and maintainability, operator overloading is limited:
|
||||||
|
|
||||||
- It's only possible to overload `+, -, *, /, %, <, >, ==, !=, <=, >=` operators.
|
- It's only possible to overload `+, -, *, /, %, <, >, ==, !=, <=, >=` operators.
|
||||||
- `==` and `!=` are self generated by the compiler but can be overriden.
|
- `==` and `!=` are self generated by the compiler but can be overridden.
|
||||||
- Calling other functions inside operator functions is not allowed.
|
- Calling other functions inside operator functions is not allowed.
|
||||||
- Operator functions can't modify their arguments.
|
- Operator functions can't modify their arguments.
|
||||||
- When using `<` and `==` operators, the return type must be `bool`.
|
- When using `<` and `==` operators, the return type must be `bool`.
|
||||||
|
@ -5552,7 +5552,7 @@ fn C.DefWindowProc(hwnd int, msg int, lparam int, wparam int)
|
||||||
// Windows only:
|
// Windows only:
|
||||||
// If a default graphics library is imported (ex. gg, ui), then the graphical window takes
|
// If a default graphics library is imported (ex. gg, ui), then the graphical window takes
|
||||||
// priority and no console window is created, effectively disabling println() statements.
|
// priority and no console window is created, effectively disabling println() statements.
|
||||||
// Use to explicity create console window. Valid before main() only.
|
// Use to explicitly create console window. Valid before main() only.
|
||||||
[console]
|
[console]
|
||||||
fn main() {
|
fn main() {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue