mirror of
https://github.com/vlang/v.git
synced 2025-09-15 07:22:27 +03:00
Update users.v
This commit is contained in:
parent
66d5d9ef32
commit
71d6eb9990
1 changed files with 1 additions and 2 deletions
|
@ -31,7 +31,7 @@ fn main() {
|
||||||
// Types can be passed as arguments
|
// Types can be passed as arguments
|
||||||
users := json.decode([]User, s)
|
users := json.decode([]User, s)
|
||||||
// Encoding JSON doesn't require a type, since V knows what type
|
// Encoding JSON doesn't require a type, since V knows what type
|
||||||
// `user` has
|
// the variable `users` has
|
||||||
println(json.encode(users))
|
println(json.encode(users))
|
||||||
// Please note the difference between V and Go:
|
// Please note the difference between V and Go:
|
||||||
// when there's only one variable, it's a value, not an index.
|
// when there's only one variable, it's a value, not an index.
|
||||||
|
@ -60,7 +60,6 @@ fn (u User) can_register() bool {
|
||||||
return u.age >= 16
|
return u.age >= 16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Here `u` can be modified and it will always be a reference.
|
// Here `u` can be modified and it will always be a reference.
|
||||||
fn (u mut User) register() {
|
fn (u mut User) register() {
|
||||||
u.is_registered = true
|
u.is_registered = true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue