Nim Programming Cookbook // Tables

Hash tables (dictionary in Python) are known as tables in Nim.

Hash table operations

import tables
import strutils

let characters = {"Bojack": "Horse", "Princess": "Cat", "Todd": "Human"}.toTable
for name, animal in characters:
    echo "$1 is a $2" % [name, animal]

tables module provides toTable.

The formatting % is provided by strutils module.