是否有任何常量变量或proc
允许以字符串或数字的形式访问编译器版本?
答案 0 :(得分:5)
The version can be obtained as a string通过system.NimVersion
(记住system
是隐式导入的):
echo NimVersion # 0.18.0
You can also access its component parts(MAJOR.MINOR.PATCH)像这样的数字:
echo NimMajor # 0
echo NimMinor # 18
echo NimPatch # 0
与元组结合使用时,这使得检查版本的兼容性非常容易:
when (NimMajor, NimMinor, NimPatch) >= (0, 19, 0):
echo "we're on at least Nim v0.19.0"