KeywordsΒΆ

As per the official V documentation.

  • fn - begins a function declaration in any of these shapes:

    1. Pure function without specified return type i.e. having the default void return type.

      fn name()
      fn name(arg int, arg2 string, ...)
      
    2. Pure function with specified return type.

      fn name() int
      fn name(arg int, arg2 string, ...) int
      
    3. Struct method without and with argument and result types.

      fn (m MyStruct) name() int
      fn (m MyStruct) name(arg int, arg2 string, ...) int
      

    For more examples and explanation check functions and methods in V documentation.

  • import - imports a module so a program can access it and its public symbols such as constants, structs or functions

  • mut - makes a variable mutable (editable)

  • in - checks whether array or map on the right side contains a value on the left side (value in array, see in keyword for more)

  • break - breaks an iteration of a for loop

  • const - declares a module-level variable that will never change (see const keyword for more)

  • return - returns a value from a function

  • exit - exits a program when encountered, allows user to specify the exit code for operating system

  • continue - immediately skips to the next iteration of a loop

  • break - stops the loop from any further iteration

  • panic - exits a program and marks the program as unsuccessfully stopped with an exit code.