KeywordsΒΆ
As per the official V documentation.
fn- begins a function declaration in any of these shapes:Pure function without specified return type i.e. having the default
voidreturn type.fn name() fn name(arg int, arg2 string, ...)
Pure function with specified return type.
fn name() int fn name(arg int, arg2 string, ...) int
Struct method without and with argument and result types.
fn (m MyStruct) name() int fn (m MyStruct) name(arg int, arg2 string, ...) int
import- imports a module so a program can access it and its public symbols such as constants, structs or functionsmut- makes a variable mutable (editable)in- checks whetherarrayormapon the right side contains a value on the left side (value in array, seeinkeyword for more)break- breaks an iteration of aforloopconst- declares a module-level variable that will never change (seeconstkeyword for more)return- returns a value from a functionexit- exits a program when encountered, allows user to specify the exit code for operating systemcontinue- immediately skips to the next iteration of a loopbreak- stops the loop from any further iterationpanic- exits a program and marks the program as unsuccessfully stopped with an exit code.