From 0b2841d4eab60e7390d9888b511c2b4a850a7b97 Mon Sep 17 00:00:00 2001 From: Larpon Date: Wed, 14 Sep 2022 09:32:09 +0200 Subject: [PATCH] docs: add nested map example. Closes #15751 (#15753) --- doc/docs.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index 6bac0e789f..e84c3123b6 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -24,9 +24,9 @@ It is easy, and it takes only a few seconds: [https://github.com/vlang/v#installing-v](https://github.com/vlang/v#installing-v---from-source-preferred-method) ## Upgrading V to latest version -If V is already installed on a machine, it can be upgrade to latest version +If V is already installed on a machine, it can be upgraded to its latest version by using the V's built-in self-updater. -To upgrade the version run the command ` v up` +To do so, run the command `v up`. ## Table of Contents @@ -1278,6 +1278,19 @@ val2 := arr[333]? println(val2) ``` +V also supports nested maps: +```v +mut m := map[string]map[string]int{} +m['greet'] = { + 'Hello': 1 +} +m['place'] = { + 'world': 2 +} +m['code']['orange'] = 123 +print(m) +``` + Maps are ordered by insertion, like dictionaries in Python. The order is a guaranteed language feature. This may change in the future.