Posts

Showing posts with the label Control Statements

C# Control Statements

  The conditional statements of C#:   if if-else if-else-if Nested if Switch Nested switch IF Statement   The if statement checks the given condition. If the condition evaluates to be true, then the block of code/statements will execute, otherwise not.  Syntax:     if(condition) { //code to be executed } Note:  If the curly brackets {} are not used with if statements then the statement just next to it is only considered associated with the if statement.  Example:     if (condition) statement 1; statement 2; In this example, only statement 1 is considered to be associated with the if statement. Example:     C# // C# program to illustrate if statement using System;   public class GFG {        public static void Main( string [] args)      {          string name = "Nustware" ;       ...