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?
Asked
Active
Viewed 499 times
1 Answers
9
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
.

def-
- 5,275
- 20
- 18