V (programming language): Difference between revisions

Content deleted Content added
Rewrite methods example
m Name of method changed to fit the example given
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 enrolledenrolled_status method (below) has a receiver of type {{code|1=Client}} named {{code|1=x}}. The convention is not to use receiver names like self or this, but preferably a short name. For example:<ref name="Knott"/><ref name="nasufi"/><syntaxhighlight lang="v">
struct Client {
enrolled bool