"Verified" ~ "verified*" ~ "verified^" Study Cube Learning: C# statements

Tuesday, May 26, 2020

C# statements

C# statements are an executable part of the program it will perform some action. There are multiple types of statements.

  •  Expression Statements.
  •  Compound Statements.
  •  Selection Statements.
  •  Iterative Statements.
  •  Jump Statements.

Expression Statements: 

An expression followed by a semicolon is called an expression statement.

Example:-

40 > 50;

d = 10 + 20 * 30;

M = N + 10 ;

x ? y : z ;

Compound Statement :

It is a combination of several expression statements. Compound Statement are grouped together in braces{}.

We can also call as Block Statement.

Example:-

{

int num1 =10, num2=20, sum;

sum = num1+ num2;

Console.WriteLine (sum);

Console.ReadLine();

}

 Selection Statements :

Selection Statements are used for decisions making purposes. Some examples of Selection statements. We will discuss briefly in the upcoming session.

  • if
  • if…else
  • switch

 Iterative Statements :

If we need to perform a part of program many times then we will use loops. It is also called Loops. We will discuss briefly in the upcoming session.

  • for loop.
  • while loop.
  • do-while loop.

Jump Statements :

Jump statements are used to transfer control from one location to another location in the program. We will discuss briefly in the upcoming session. 

  • goto.
  • continue.
  • break.
  • return.
  • throw

 


No comments:

Post a Comment

Choose the Right Graphic Designer

 Picking a decent visual originator is critical in the improvement of your image. There are many visual originators around and everybody you...