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

docs: fix remaining muts

This commit is contained in:
axinli 2020-04-16 11:52:35 +08:00 committed by GitHub
parent e1a2a4f362
commit 5e4c5f189f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -322,7 +322,7 @@ println(upper) // ['HELLO', 'WORLD']
## Maps
```v
mut m := map[string]int // Only maps with string keys are allowed for now
var m := map[string]int // Only maps with string keys are allowed for now
m['one'] = 1
m['two'] = 2
println(m['one']) // "1"
@ -557,7 +557,7 @@ button.widget.set_pos(x,y)
Struct fields are private and immutable by default (making structs immutable as well).
Their access modifiers can be changed with
`pub` and `mut`. In total, there are 5 possible options:
`pub` and `var`. In total, there are 5 possible options:
```v
struct Foo {
@ -588,7 +588,6 @@ pub:
It's easy to see from this definition that `string` is an immutable type.
The byte pointer with the string data is not accessible outside `builtin` at all.
`len` field is public, but not mutable:
```v
fn main() {
str := 'hello'
@ -634,7 +633,7 @@ This is achieved by lack of global variables and all function arguments being im
even when references are passed.
V is not a pure functional language however.
It is possible to modify function arguments by using the same keyword `mut`:
It is possible to modify function arguments by using the same keyword `var`:
```v
struct User {