tables work in 'const' sections; echo supports 'nil' strings; minor cleanups
This commit is contained in:
parent
9431b734b4
commit
ecd0dea091
11 changed files with 69 additions and 52 deletions
19
tests/vm/tconsttable.nim
Normal file
19
tests/vm/tconsttable.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
discard """
|
||||
output: '''is
|
||||
finally
|
||||
nice!'''
|
||||
"""
|
||||
|
||||
import tables
|
||||
|
||||
const
|
||||
foo = {"ah": "finally", "this": "is", "possible.": "nice!"}.toTable()
|
||||
|
||||
# protect against overly smart compiler:
|
||||
var x = "this"
|
||||
|
||||
echo foo[x]
|
||||
x = "ah"
|
||||
echo foo[x]
|
||||
x = "possible."
|
||||
echo foo[x]
|
||||
Loading…
Add table
Add a link
Reference in a new issue