C# if-else Statement

As we saw in If statement only execute the code if the condition is true, but if the condition is not true then what to do? For this purpose we have C# if-else Statement. An if-else statement in C# is used to tells the code what to do next when the if condition is not … Read more

Categories C#

C# String

String in C# is a sequence of Unicode characters or maybe it can be an array of characters. To represent String in C# we use a class named System. The string keyword is an alias for the System.String class. String in C# represents the array of characters (known as text). The string is a reference type. It can … Read more

C# If statement

 C# if statement is used to execute the particular block of code or statements when the defined condition is true. There is a conditional statement upon which given statements execute. If statement checks the given condition and evaluates the result. An if statement in C# can consist of a boolean expression which is followed by one or more … Read more

Categories C#

C# Nested-Switch Statement

C# Nested-Switch Statement has a switch statement inside another switch statement. There is a parent switch. The inner switch is present in one of the cases in the parent switch. It is possible to have a switch as part of the statement sequence of an outer switch. Even if the case constants of the inner … Read more

Categories C#

C# For Loop

C# For Loop has similar functionality as while loop but with different syntax. For loops are preferred when the number of times loop statements are to be executed is known beforehand. The loop variable initialization, condition to be tested, and increment/decrement of the loop variable are done in one line in for loop thereby providing … Read more

Categories C#

C# Nested-if statement

If there is an if statement inside another if statement, it’s known as C# Nested-if statement. In this statement, you can use one if or else if statement inside another if or else if statement(s). If the value of test-expression is true, the true block of statements will be executed in this type of construct. … Read more

Categories C#

C# do-while loop

The C# do-while loop is similar to the while loop. But there is one difference that the do-while loop checks the condition after executing the statements. Syntax: Graphical representation: C# do-while loop The control returns to the beginning of the loop if the condition is true. The control exits the loop when the condition is … Read more

Categories C#

C# Decision Making

C# Decision Making is used to requires the programmer to specify any one or more conditions to be evaluated by the program. In decision making, a certain block of code needs to be executed when given condition is fulfilled. It execute a statement or set of statements. If the given condition is determined to be … Read more

Categories C#

C# Switch Statement

C# Switch Statement allows a variable to be tested for equality against a list of values. In the switch statement, each value is known as a case, and the variable which is being switched on is checked for each switch case. The switch statement is also known as long if-else-if ladders. The given expression is checked … Read more

Categories C#

C# Methods

C# Methods are the group of statements that perform a task altogether. Storing a set of statements in a single module eliminates the need to rewrite the same code or makes a specific operation more frequently used. The method in C# is a discrete code block that contains many statements that perform specialised tasks. To … Read more

Categories C#