Module 12 - Windows Forms

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 14

Module 12:

Windows Forms

By

SRIRAM . B
Overview

 Statement
 Selection
 Iteration
 Jump
Statements
 Statements are the smallest unit of
execution in C# programs. They can be
grouped into sequences using curly braces.
These are called Compound Statements or
Blocks. A compound statement can be used
in place of simple statement.
 C# provides variety of statements. Most of
the statements are similar to C,C++,Java.
 The statements in C# can be categorized as:
 Selection Statements
 Iteration Statements
 Jump Statements
Selection Statements

 Selection Statements selects one of a


number of possible statements for
execution based on the value of a
controlling expression.
 A selection statement can be:-
 If Statement
 Switch Statement
If Statement

 The If statement selects a statement


for execution based on the value of a
Boolean expression.
 Syntax:-
If(condition 1)
statement_1
Else
statement_2
Nested If

 The If statement may be nested to


many levels. This means If statement
may contain another If statement.
 Syntax:-
If(condition 1)
If(condition 2)
statement_1
Else
statement_2
Switch Statement

 A switch…case statement executes as


follows:
The switch expression is evaluated first
and acts as the control of execution.
If the value of the case label matches
the switch expression, then the
statements following it are executed.
A label in a case is a fixed value.
If no label matches the value of the
switch expression, then the statements
following the default label are executed.
If there is no match and there is no
default label then control is transferred
to the end of the switch statement.
switch(expression)
{
case <label>:
Statements
case <label>:
Statements
default:
Statements
}
Session Ends
Exercise
Relax

You might also like