#undef, #elif, and #else preprocessor directives

#define DEBUG
#undef DEBUG
#define PRODUCTION
class Test {
public static void Main() {
int total = 0;
int counter = 10;
myLabel:
System.Console.WriteLine("counter = " + counter);
if (counter < 5) {
#if DEBUG
System.Console.WriteLine("goto myLabel");
#elif PRODUCTION
System.Console.WriteLine("counter < 5");
#else
System.Console.WriteLine("goto myLabel, counter < 5");
#endif
goto myLabel;
}
System.Console.WriteLine("total = " + total);
}
}
Related examples in the same category