Quantcast
Channel: 2,000 Things You Should Know About C# » #if
Browsing latest articles
Browse All 11 View Live

Image may be NSFW.
Clik here to view.

#170 – The else Portion of an if Statement

An if statement can optionally include an else keyword and block of statements, which will execute if the boolean expression for the if statement evaluates to false. if (age >= 50) {...

View Article



Image may be NSFW.
Clik here to view.

#172 – Nested if Statements

The statement to be executed when an if statement’s boolean expression resolves to true can be another if statement. if (bob.IsSingle) if (TheGameIsOnToday()) WatchGame(); else PlayVideoGames();...

View Article

Image may be NSFW.
Clik here to view.

#480 – Pre-Processing Directives

Pre-processing directives are elements that you can include in your source code that are not part of the source code itself.  Instead, they instruct the C# compiler to perform some particular action,...

View Article

Image may be NSFW.
Clik here to view.

#499 – Conditional Compilation Symbols Are Defined or Undefined

At any given point in your source code, while the compiler is compiling that section of code, a particular conditional compilation symbol is either defined or undefined. You define a conditional...

View Article

Image may be NSFW.
Clik here to view.

#503 – Conditionally Compile Code Using #if / #endif Directives

Once you define a conditional compilation symbol using the #define directive, you can use the #if directive to conditionally compile code when the corresponding conditional compilation symbol is...

View Article


Image may be NSFW.
Clik here to view.

#504 – Using the #else Directive

You can conditionally compile code using the #if and #endif preprocessor directive.  You can also use an #else clause between the #if and the #endif. In the code below, we’ve commented out the...

View Article

Image may be NSFW.
Clik here to view.

#505 – Using the #elif Directive

When you check whether a conditional compilation symbol is defined using the #if, #else and #endif directives, you can include additional clauses within the scope of the #if directive by using the...

View Article

Image may be NSFW.
Clik here to view.

#506 – Using Expressions in #if and #elif Directives

You can use more complex expressions in #if and #elif directives, instead of just checking to see whether a single conditional compilation symbol is defined. In the example below, the #elif directive...

View Article


Image may be NSFW.
Clik here to view.

#507 – You can #define Other Symbols within a #if Block

Within the body of an #if/#endif pair, you can include #define or #undef directives.  If the body of the #if does contain #define or #undef directives, it must appear before the first token of the...

View Article


Image may be NSFW.
Clik here to view.

#1,126 – Rewriting a Loop to Avoid continue Statement

The continue statement allows jumping to end of the body of a loop, skipping the rest of the code within the loop.  Either the next iteration of the loop executes, or the code following the loop...

View Article
Browsing latest articles
Browse All 11 View Live




Latest Images