const useMe = true
when defined(useMe):
echo "useMe is defined"
else:
echo "useMe is not defined"
Looks like you can only use "defined" with symbols defined on the command line or the built in ones. I cannot find where "defined" is documented, it's hard to search for it.
Writing useMe and declared(useMe) are two completely different things.
The first one checks if the value of useMe is true. If useMe isn't created somewhere before this when there's going to be a compile error. The second one checks if evenMe exists at all, the value of it then doesn't matter.
you find declared and defined in the Standard lib docs: https://nim-lang.org/docs/system.html#defined,untyped and https://nim-lang.org/docs/system.html#declared,untyped
Goto https://nim-lang.org/docs/theindex.html press control+F, type "defined", click on https://nim-lang.org/docs/system.html#defined,untyped
Alternatively open any kind of documentation .html file and type in "defined" in the search bar, click on https://nim-lang.org/docs/system.html#defined,untyped
It's clear to everyone coming from a C/C++ background - #define vs. cdecl ; Someone coming from a Java or Python background might not find it as intuitive.
Although, I must say I don't have a better suggestion.
defined -> isSet