Skip to content

Instantly share code, notes, and snippets.

@loloicci
Created February 24, 2019 09:16
Show Gist options
  • Save loloicci/d1fc07ccc725a4ca37b09d42852a27f5 to your computer and use it in GitHub Desktop.
Save loloicci/d1fc07ccc725a4ca37b09d42852a27f5 to your computer and use it in GitHub Desktop.
import tables
type
CT = Table[string, int]
proc makeConstTable(): CT =
result = initTable[string, int]()
result.add("one", 1)
result.add("two", 2)
result.add("three", 3)
const
a: CT = {"one": 1, "two": 2, "three": 3}.toTable
b: CT = makeConstTable()
echo (a == b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment