by customguy · 2mo ago · 0 comments
//*
normal path
/*/
debug path
//*/
take away the the first slash to toggle the debug zone ON! #if 0
// Normal path
#else
// Debug path
#endif
Only works with C and C++, though.#if DEBUG
Console.WriteLine("This only compiles and runs in Debug mode.");
#else Console.WriteLine("This only compiles and runs in Release mode.");
#endifhere's python:
#'''
normal path
'''
debug path
#'''
when I comment out python code I do it with ''' ... #''' so I can uncomment it with 1 keystroke/**/
Debug code to toggle on and off
/**/ Other debug code to toggle on and off
/**/And toggled by removing the last slash on one of the comment lines.
Having two `*` characters worked better for syntax highlighting at the time.
Then I learned about Ctrl/Cmd + / to toggle a line or region on and off.
But I still use the old technique when code editors can't handle where comments are supposed to start and stop and commenting out too much or breaking the indentation, typically breaking around modern CSS's newer features or languages embedded within other languages.