mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-24 08:15:25 +00:00
tables work in 'const' sections; echo supports 'nil' strings; minor cleanups
This commit is contained in:
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]
|
||||
Reference in New Issue
Block a user