What tips do you have for code-golfing in the V lang? I have been trying to find ways to shorten codegolfs on there but can't find any resources on it. Do you guys have any?

Please suggest tips that are at least somewhat specific to the V programming language (e.g. "remove comments" isn't helpful).

Please post one tip per answer.


2 Answers 2


When making an instance of a struct, you can omit argument names if they're in the right order.


If the type is already known, you can omit Person, but you'll have to explicitly give the field names.

When making a change to an object, you can copy it by placing ...x at the start (where x is the object to copy from).


Remove unnecessary whitespace

Take the following code:

mut x:="foo"

You can rewrite the code like so:

mut x:="foo"println(x)x+="bar"println(x)

This is still perfectly valid syntax. In general, any two statements can be combined if they are separated by a symbol (though this is not always the case).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.