From 28cada3fd5f765cd43c6ebbf1ad14310138fda6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Jen=C3=9F?= Date: Sun, 31 Oct 2021 13:12:04 +0100 Subject: [PATCH] docs: fix some typos (#12341) --- doc/docs.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index b6b4afc075..4f4970b9f2 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -499,8 +499,8 @@ s[0] = `H` // not allowed ``` > 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`. -Indexes correspond to bytes in the string, not Unicode code points. If you want to +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 convert the `byte` to a `string`, use the `ascii_str()` method: ```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. 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 has its default value, otherwise the compiler will produce this error message, when you call the function with no parameters: @@ -2783,7 +2783,7 @@ println('Grocery IDs: $g1, $g2, $g3') 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 @@ -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 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` 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]` 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 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: - 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. - Operator functions can't modify their arguments. - 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: // 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. -// Use to explicity create console window. Valid before main() only. +// Use to explicitly create console window. Valid before main() only. [console] fn main() { }