Content deleted Content added
m Spaces removed in struct examples to be consistent with documentation, books on subject, and to prevent confusion |
Rewrite of method example and to be consistent with tag removal of struct examples |
||
Line 126:
[[Method (computer programming)|Methods]] in V are functions defined with a receiver [[Parameter (computer programming)|argument]]. The receiver appears in its own argument list between the fn keyword and the method name. Methods must be in the same [[Modular programming|module]] as the receiver type.
The
<syntaxhighlight lang="V">
struct
age int
}
fn (
return
}
age:
}
println(user.is_registered()) // "false"▼
age:
}
println(
</syntaxhighlight>
</div>
|