tconsttable.nim 262 B

1234567891011121314151617181920
  1. discard """
  2. output: '''is
  3. finally
  4. nice!'''
  5. """
  6. import tables
  7. const
  8. foo = {"ah": "finally", "this": "is", "possible.": "nice!"}.toTable()
  9. # protect against overly smart compiler:
  10. var x = "this"
  11. echo foo[x]
  12. x = "ah"
  13. echo foo[x]
  14. x = "possible."
  15. echo foo[x]