Skip to content

Instantly share code, notes, and snippets.

@honewatson
Created January 19, 2015 00:46
Show Gist options
  • Save honewatson/a6565f3d06cc5abe3f03 to your computer and use it in GitHub Desktop.
Save honewatson/a6565f3d06cc5abe3f03 to your computer and use it in GitHub Desktop.
Table example ( nimlang, nimrod, nim lang)
import tables, hashes
echo "Not ordered table"
var t = {"key1": "value1", "key2":"computer blue", "key3": "value2"}.newTable
t.add("blue", "b")
echo t["blue"]
for x, y in t:
echo x, y
echo "Ordered table"
var n = {"key1": "value1", "key2":"computer blue", "key3": "value2"}.newOrderedTable
n.add("blue", "b")
for x, y in n:
echo x, y
@kcvinker
Copy link

Pls explain how to declare empty table and fill it later.

@ynfle
Copy link

ynfle commented Jun 22, 2020

Pls explain how to declare empty table and fill it later.
@vinodvinu

newOrderedTable[string, string]()

@kcvinker
Copy link

At last, after one year, when i temporarily quit Nim programming, i got the answer. Thanks. :)

@ynfle
Copy link

ynfle commented Jun 22, 2020

No problem.

If you are looking for practice exercises and some mentoring for Nim, check out Exercism.io

@kcvinker
Copy link

Wow ! That's great. Will check soon. Thanks for the guidance.

@ynfle
Copy link

ynfle commented Jun 25, 2020

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment