Update users.v

This commit is contained in:
Alexander Medvednikov 2019-02-19 14:35:48 +01:00 committed by GitHub
parent 66d5d9ef32
commit 71d6eb9990
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,7 @@ fn main() {
// Types can be passed as arguments
users := json.decode([]User, s)
// Encoding JSON doesn't require a type, since V knows what type
// `user` has
// the variable `users` has
println(json.encode(users))
// Please note the difference between V and Go:
// 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
}
// Here `u` can be modified and it will always be a reference.
fn (u mut User) register() {
u.is_registered = true