Related Articles

Back to Latest Articles

C# Basics – Conditional Statements – Part 5

Let's have a look at some of the logic operators in C# programming language.

Andraz Krzisnik
C# Basics – Conditional Statements...

Conditional Statements

There is a data type for logic operations, called bool. Possible values that this kind of variable can hold are true and false.

Let’s take a look at logic operators:

  • && – AND
  • || – OR
  • ! – NOT

Comparative Operations

With comparative operators we compare two values. And they always return a bool value, true or false, that is.

If Statement

We use if statement when we want to execute some code when conditions of this if statements, are met.

If-Else Statement

We use if else statement when we want something to happen even if conditions of if statement aren’t met.

Nested If Statements

A nested if statement is an if statement within another if statement. We can also add more if statements that would execute perhaps some different code if there are more than one if statements paired with else.

Download Examples Next Chapter
Show Comments (0)


Related Articles

C# Tutorial

C# Tutorial: How To Create Gaussian Blur

Gaussian blur is an image processing operation, that reduces noise in images. It does so by a convolution process, using a matrix that contains values calculated by a Gaussian...

Posted on by Andraz Krzisnik
C# Tutorial

C# Tutorial: How To Scale Images Without Deforming Them

Let’s Get Started A very basic problem that we face in image processing is how to scale images without making them look deformed when we want to make it of an arbitrary...

Posted on by Andraz Krzisnik