From bb54d8ae7e6776f1efee6b6d7a7b32b814a53c8f Mon Sep 17 00:00:00 2001 From: rsirres Date: Thu, 29 Dec 2016 15:26:31 +0100 Subject: [PATCH] Add Nim Dictionaries --- Nim-for-Python-Programmers.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Nim-for-Python-Programmers.md b/Nim-for-Python-Programmers.md index ef4f173..e82f784 100644 --- a/Nim-for-Python-Programmers.md +++ b/Nim-for-Python-Programmers.md @@ -168,6 +168,17 @@ Use [Nim sequences](http://nim-lang.org/docs/tut1.html#advanced-types-sequences) Nim arrays and sequences can hold only items of the same type. +### Python dictionaries + +``` Nim +import tables + +var a = {"hallo": "World", "Key2": "Value2"}.newTable + +for key, value in a: + echo key, " " ,value +``` + #### List Comprehensions ``` import future # required for the list comprehension syntactical sugar