I have a line of code that I want to run in debug mode but not in release mode. Is there a way to automatically handle this?
when not defined(release):
echo "Debug"
Compiler options set with -d
, like -d:release
, can be used in the program using the defined
proc: https://nim-lang.org/docs/system.html#defined,untyped
Since it's available at compile-time we can use a when
(compile-time if) instead of a regular runtime if
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With