diff --git a/doc/docs.md b/doc/docs.md index ef88fb6cfd..9d00d9828d 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -1716,15 +1716,22 @@ const ( blue = rgb(0, 0, 255) ) -println(numbers) -println(red) -println(blue) +println(main.numbers) +println(main.red) +println(main.blue) ``` Global variables are not allowed, so this can be really useful. +When naming constants, `snake_case` must be used. In order to distinguish consts +from local variables, the full path to consts must be specified. For example, +to access the PI const, full `math.pi` name must be used both outside the `math` module, +and inside it. This can be seen in the example above with `println(main.numbers)`. + +vfmt takes care of this rule, so you can type `println(pi)` inside the `math` module, +and vffmt will automatically update it to `println(math.pi)`. +