SlideShare una empresa de Scribd logo
1 de 8
Page 1 of 8
 The first line of the program using System; the using keyword is used to include the System namespace
in the program. A program generally has multiple using statements.
 The next line has the namespace declaration. A namespace is a collection of classes. The “Hello World”
Application namespace contains the class Hello World.
 The next line has a class declaration, the class Hello World contains the data and method definitions that
your program uses. Classes generally would contain more than one method. Methods define the behavior
of the class. However, the Hello World class has only one method Main.
 The next line defines the Main method, which is the entry point for all C# programs. The Main method
states what the class will do when executed
 The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the
program.
 The Main method specifies its behavior with the statement Console.WriteLine("Hello World");
WriteLine is a method of the Console class defined in the System namespace. This statement causes the
message "Hello, World!" to be displayed on the screen.
 The last line Console.ReadKey(); is for the VS.NET Users. This makes the program wait for a key press
and it prevents the screen from running and closing quickly when the program is launched from Visual
Studio .NET.
Its worth to naote the following points:
 C# is case sensitive.
 All statements and expression must end with a semicolon (;).
 The program execution starts at the main method.
 Unlike Java, file name could be different from the class name.
C# Type Conversion Methods: C# provides the following built-in type conversion methods:
Page 2 of 8
S.N Methods & Description
1
ToBoolean
Converts a type to a Boolean value, where possible.
2
ToByte
Converts a type to a byte.
3
ToChar
Converts a type to a single Unicode character, where possible.
4
ToDateTime
Converts a type (integer or string type) to date-time structures.
5
ToDecimal
Converts a floating point or integer type to a decimal type.
6
ToDouble
Converts a type to a double type.
7
ToInt16
Converts a type to a 16-bit integer.
8
ToInt32
Converts a type to a 32-bit integer.
9
ToInt64
Converts a type to a 64-bit integer.
10
ToSbyte
Converts a type to a signed byte type.
11
ToSingle
Converts a type to a small floating point number.
12
ToString
Converts a type to a string.
13
ToType
Converts a type to a specified type.
14
ToUInt16
Converts a type to an unsigned int type.
15
ToUInt32
Converts a type to an unsigned long type.
16
ToUInt64
Converts a type to an unsigned big integer.
Page 3 of 8
Accepting Values from User:
The Console class in the System namespace provides a function ReadLine() for accepting input from the user and store it into a
variable.
Arithmetic Operators:
Operator Description Example
+ Adds two operands A + B will give 30
- Subtracts second operand from the first A - B will give -10
* Multiplies both operands A * B will give 200
/ Divides numerator by de-numerator B / A will give 2
% Modulus Operator and remainder of after an integer division B % A will give 0
++ Increment operator increases integer value by one A++ will give 11
-- Decrement operator decreases integer value by one A-- will give 9
Relational Operators:
Operator Description Example
== Checks if the values of two operands are equal or not, if yes then condition becomes true.
(A == B)
is not
true.
!=
Checks if the values of two operands are equal or not, if values are not equal then condition
becomes true.
(A != B)
is true.
>
Checks if the value of left operand is greater than the value of right operand, if yes then
condition becomes true.
(A > B)
is not
true.
<
Checks if the value of left operand is less than the value of right operand, if yes then condition
becomes true.
(A < B)
is true.
>=
Checks if the value of left operand is greater than or equal to the value of right operand, if yes
then condition becomes true.
(A >= B)
is not
true.
<=
Checks if the value of left operand is less than or equal to the value of right operand, if yes
then condition becomes true.
(A <= B)
is true.
Logical Operators:
Page 4 of 8
Operator Description Example
&& Called Logical AND operator. If both the operands are non zero then condition becomes true.
(A && B)
is false.
||
Called Logical OR Operator. If any of the two operands is non zero then condition becomes
true.
(A || B)
is true.
!
Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is
true then Logical NOT operator will make false.
!(A &&
B) is
true.
Conditions:
Statement Description
if statement
An if statement consists of a boolean expression followed by one or more
statements.
if...else statement
An if statement can be followed by an optional else statement, which
executes when the boolean expression is false.
nested if statements
You can use one if or else if statement inside another if or else
if statement(s).
switch statement
A switch statement allows a variable to be tested for equality against a list of
values.
nested switch statements You can use one switch statement inside another switchstatement(s).
C# - Loops: A loop statement allows us to execute a statement or group of statements multiple times .
Loop Type Description
while loop
Repeats a statement or group of statements while a given condition is true. It tests
the condition before executing the loop body.
for loop
Executes a sequence of statements multiple times and abbreviates the code that
manages the loop variable.
do...while loop Like a while statement, except that it tests the condition at the end of the loop body
nested loops You can use one or more loop inside any another while, for or do..while loop.
Loop Control Statements:
Page 5 of 8
Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that
were created in that scope are destroyed.
Control Statement Description
break statement
Terminates the loop or switch statement and transfers execution to the statement
immediately following the loop or switch.
continue statement
Causes the loop to skip the remainder of its body and immediately retest its
condition prior to reiterating.
C# - Arrays:
An array stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it
is often more useful to think of an array as a collection of variables of the same type.
Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array variable such as
numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. A specific element in an array is
accessed by an index.
Declaring Arrays:
To declare an array in C#, you can use the following syntax:
datatype[] arrayName;
where,
 datatype is used to specify the type of elements to be stored in the array.
 [ ] specifies the rank of the array. The rank specifies the size of the array.
 arrayName specifies the name of the array.
For example,
double[] balance;
Initializing an Array
Array is a reference type, so you need to use the new keyword to create an instance of the array.
For example,
double[] balance = new double[10];
Page 6 of 8
Code Description
abstract The abstract modifier can be used with classes, methods, properties, indexers, and events.
as The as operator is used to perform conversions between compatible types.
base The base keyword is used to access members of the base class from within a derived class
bool
The bool keyword is an alias of System.Boolean. It is used to declare variables to store the
Boolean values, true and false.
break The keyword break is used to exit out of a loop or switch block.
byte It represents an 8-bit unsigned integer whose value ranges from 0 to 255.
case case is often used in a switch statement.
catch The keyword catch is used to identify a statement or statement block for execution
char It represents a Unicode character whose from 0 to 65,535.
checked
The checked keyword is used to control the overflow-checking context for integral-type
arithmetic operations and conversions.
class The class keyword is used to declare a class.
const
The const keyword is used in field and local variable declarations to make the
variable constant
continue Its affect is to end the current loop and proceed to the next one.
decimal The decimal keyword denotes a 128-bit data type.
default The default keyword can be used in the switch statement
delegate
The delegate keyword is used to declare a delegate. A delegate is a programming construct
that is used to obtain a callable reference to a method of a class.
do
The do statement executes a statement or a block of statements repeatedly until a specified
expression evaluates to false.
double The double keyword denotes a simple type that stores 64-bit floating-point values.
else
An else clause immediately follows an if-body. It provides code to execute when
the condition is false.
enum
The enum keyword is used to declare an enumeration, a distinct type consisting of a set of
named constants called the enumerator list.
event It is used to declare an event.
explicit The explicit keyword is used to declare an explicit user-defined type conversion operator
extern
Use the extern modifier in a method declaration to indicate that the method is implemented
externally.
false The false keyword is a boolean constant value
finally The finally block is useful for cleaning up any resources allocated in the try block.
fixed Prevents relocation of a variable by the garbage collector.
float The float keyword denotes a simple type that stores 32-bit floating-point values.
for
The for loop executes a statement or a block of statements repeatedly until a specified
expression evaluates to false.
foreach
The foreach statement repeats a group of embedded statements for each element in an array
or an object collection.
Page 7 of 8
goto The goto statement transfers the program control directly to a labeled statement.
if
The if statement selects a statement for execution based on the value of a Boolean
expression.
implicit The implicit keyword is used to declare an implicit user-defined type conversion operator.
in The in keyword identifies the collection to enumerate in a foreach loop.
int The int keyword denotes an integral type that stores values according to the size and range
interface
The interface keyword is used to declare an interface. Interfaces provide a construct for a
programmer to create types that can have methods, properties, delegates, events, and
indexers declared, but not implemented.
internal
The internal keyword is an access modifier for types and type members. That is, it is
only visible within the assembly that implements it.
is
The is operator is used to check whether the run-time type of an object is compatible with a
given type. Using is on a null variable always returns false.
lock
The lock keyword marks a statement block as a critical section by obtaining the mutual-
exclusion lock for a given object, executing a statement, and then releasing the lock.
long
The long keyword denotes an integral type that stores values according to the size and
range.That is, it represents a 64-bit signed integer whose value ranges from -
9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
namespace
The namespace keyword is used to supply a namespace for class, structure, and type
declarations.
new In C#, the new keyword can be used as an operator or as a modifier.
null
The null keyword is a literal that represents a null reference, one that does not refer to any
object.
object It represents the base class from which all other reference types derive.
operator The operator keyword is used to declare an operator in a class or struct declaration.
out
The out method parameter keyword on a method parameter causes a method to refer to the
same variable that was passed into the method
override Use the override modifier to modify a method, a property, an indexer, or an event.
params
The keyword params is used to describe when a grouping of parameters are passed to a
method, but the number of parameters are not important, as they may vary.
private
To make the field, method, or property private to its enclosing class. That is, it is
not visible outside of its class.
protected
To make the field, method, or property protected to its enclosing class. That is, it is
not visible outside of its class.
public
To make the field, method, or property public to its enclosing class. That is, it is visible from
any class.
readonly The readonly keyword is a modifier that you can use on fields.
ref
The ref keyword explicitely specifies that a variable should be passed by reference rather
than by value.
return The return statement terminates execution of the method in which it appears and returns
Page 8 of 8
control to the calling method.
sbyte It represents an 8-bit signed integer whose value ranges from -128 to 127.
sealed A sealed class cannot be inherited.
short It represents a 16-bit signed integer whose value ranges from -32,768 to 32,767.
sizeof The sizeof keyword returns how many bytes an object requires to be stored.
stackalloc Allocates a block of memory on the stack.
static
Use the static modifier to declare a static member, which belongs to the type itself rather than
to a specific object.
string The string type represents a string of Unicode characters.
struct
A struct type is a value type that can contain constructors, constants, fields, methods,
properties, indexers, operators, events, and nested types.
switch
The switch statement is a control statement that handles multiple selections by passing
control to one of the case statements within its body.
this
The this keyword refers to the current instance of the class. Static member functions do not
have a this pointer.
throw
The throw statement is used to signal the occurrence of an anomalous situation (exception)
during the program execution.
true In C#, the true keyword can be used as an overloaded operator or as a literal.
try
The try-catch statement consists of a try block followed by one or more catchclauses, which
specify handlers for different exceptions.
typeof The typeof operator is used to obtain the System.Type object for a type.
uint
The uint keyword denotes an integral type that stores values according to the size and range
shown in the following table.
ulong
The ulong keyword denotes an integral type that stores values according to the size and
range shown in the following table.
unchecked
The unchecked keyword is used to control the overflow-checking context for integral-
type arithmetic operations and conversions.
unsafe
The unsafe keyword denotes an unsafe context, which is required for any operation
involving pointers.
ushort
The ushort keyword denotes an integral data type that stores values according to the
size and range shown in the following table.
using The using keyword has two major uses.
virtual
The virtual keyword is used to modify a method or property declaration, in which case
the method or the property is called a virtual member.
volatile
The volatile keyword indicates that a field can be modified in the program by
something such as the operating system, the hardware, or a concurrently executing
thread.
void
When used as the return type for a method, void specifies that the method does not
return a value.
while
The while statement executes a statement or a block of statements until a specified
expression evaluates to false.

Más contenido relacionado

La actualidad más candente

[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2yasir_cesc
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 
Dr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javaDr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javajalinder123
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of CSuchit Patel
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.netJaya Kumari
 
Control structures in C++ Programming Language
Control structures in C++ Programming LanguageControl structures in C++ Programming Language
Control structures in C++ Programming LanguageAhmad Idrees
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingRasan Samarasinghe
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#Raghu nath
 
javasebeyondbasics
javasebeyondbasicsjavasebeyondbasics
javasebeyondbasicswebuploader
 
Jdk1.5 Features
Jdk1.5 FeaturesJdk1.5 Features
Jdk1.5 Featuresindia_mani
 
Spf Chapter5 Conditional Logics
Spf Chapter5 Conditional LogicsSpf Chapter5 Conditional Logics
Spf Chapter5 Conditional LogicsHock Leng PUAH
 
Spf Chapter4 Variables
Spf Chapter4 VariablesSpf Chapter4 Variables
Spf Chapter4 VariablesHock Leng PUAH
 
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya UdagedaraLambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya UdagedaraJaliya Udagedara
 

La actualidad más candente (19)

[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Operators & Casts
Operators & CastsOperators & Casts
Operators & Casts
 
Dr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javaDr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic java
 
Cpu-fundamental of C
Cpu-fundamental of CCpu-fundamental of C
Cpu-fundamental of C
 
Csharp4 basics
Csharp4 basicsCsharp4 basics
Csharp4 basics
 
Operators used in vb.net
Operators used in vb.netOperators used in vb.net
Operators used in vb.net
 
Declaration of variables
Declaration of variablesDeclaration of variables
Declaration of variables
 
Control structures in C++ Programming Language
Control structures in C++ Programming LanguageControl structures in C++ Programming Language
Control structures in C++ Programming Language
 
Esoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programmingEsoft Metro Campus - Certificate in c / c++ programming
Esoft Metro Campus - Certificate in c / c++ programming
 
DITEC - Programming with Java
DITEC - Programming with JavaDITEC - Programming with Java
DITEC - Programming with Java
 
Perl slid
Perl slidPerl slid
Perl slid
 
2.overview of c#
2.overview of c#2.overview of c#
2.overview of c#
 
javasebeyondbasics
javasebeyondbasicsjavasebeyondbasics
javasebeyondbasics
 
Jdk1.5 Features
Jdk1.5 FeaturesJdk1.5 Features
Jdk1.5 Features
 
Opps concept
Opps conceptOpps concept
Opps concept
 
Spf Chapter5 Conditional Logics
Spf Chapter5 Conditional LogicsSpf Chapter5 Conditional Logics
Spf Chapter5 Conditional Logics
 
Spf Chapter4 Variables
Spf Chapter4 VariablesSpf Chapter4 Variables
Spf Chapter4 Variables
 
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya UdagedaraLambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
Lambda Expressions in C# From Beginner To Expert - Jaliya Udagedara
 

Destacado

C# language basics (Visual studio)
C# language basics (Visual studio)C# language basics (Visual studio)
C# language basics (Visual studio)rnkhan
 
Finnemore ch08 200-299
Finnemore ch08 200-299Finnemore ch08 200-299
Finnemore ch08 200-299rnkhan
 
Finnemore ch07 182-199
Finnemore ch07 182-199Finnemore ch07 182-199
Finnemore ch07 182-199rnkhan
 
Finnemore ch06 134-181
Finnemore ch06 134-181Finnemore ch06 134-181
Finnemore ch06 134-181rnkhan
 
Finnemore ch02 004-026
Finnemore ch02 004-026Finnemore ch02 004-026
Finnemore ch02 004-026rnkhan
 
Strenght of material me-ce (gate2016.info)
Strenght of material me-ce (gate2016.info)Strenght of material me-ce (gate2016.info)
Strenght of material me-ce (gate2016.info)Paritosh Kasaudhan
 
[R. k. bansal]strength of materials 4th ed[engineersday.com]
[R. k. bansal]strength of materials 4th ed[engineersday.com][R. k. bansal]strength of materials 4th ed[engineersday.com]
[R. k. bansal]strength of materials 4th ed[engineersday.com]Vijhendra Ramdatt
 
strength of materials singer and pytel solution manual (chapter 9 )
strength of materials singer and pytel solution manual (chapter 9 )strength of materials singer and pytel solution manual (chapter 9 )
strength of materials singer and pytel solution manual (chapter 9 )Ahmad Haydar
 
Engineering surveying, 5...ition w. schofield
Engineering surveying, 5...ition   w. schofieldEngineering surveying, 5...ition   w. schofield
Engineering surveying, 5...ition w. schofieldrnkhan
 
Chap#6 Beam Deflections solutions
Chap#6 Beam Deflections solutionsChap#6 Beam Deflections solutions
Chap#6 Beam Deflections solutionsrnkhan
 
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)Pawnpac
 

Destacado (11)

C# language basics (Visual studio)
C# language basics (Visual studio)C# language basics (Visual studio)
C# language basics (Visual studio)
 
Finnemore ch08 200-299
Finnemore ch08 200-299Finnemore ch08 200-299
Finnemore ch08 200-299
 
Finnemore ch07 182-199
Finnemore ch07 182-199Finnemore ch07 182-199
Finnemore ch07 182-199
 
Finnemore ch06 134-181
Finnemore ch06 134-181Finnemore ch06 134-181
Finnemore ch06 134-181
 
Finnemore ch02 004-026
Finnemore ch02 004-026Finnemore ch02 004-026
Finnemore ch02 004-026
 
Strenght of material me-ce (gate2016.info)
Strenght of material me-ce (gate2016.info)Strenght of material me-ce (gate2016.info)
Strenght of material me-ce (gate2016.info)
 
[R. k. bansal]strength of materials 4th ed[engineersday.com]
[R. k. bansal]strength of materials 4th ed[engineersday.com][R. k. bansal]strength of materials 4th ed[engineersday.com]
[R. k. bansal]strength of materials 4th ed[engineersday.com]
 
strength of materials singer and pytel solution manual (chapter 9 )
strength of materials singer and pytel solution manual (chapter 9 )strength of materials singer and pytel solution manual (chapter 9 )
strength of materials singer and pytel solution manual (chapter 9 )
 
Engineering surveying, 5...ition w. schofield
Engineering surveying, 5...ition   w. schofieldEngineering surveying, 5...ition   w. schofield
Engineering surveying, 5...ition w. schofield
 
Chap#6 Beam Deflections solutions
Chap#6 Beam Deflections solutionsChap#6 Beam Deflections solutions
Chap#6 Beam Deflections solutions
 
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
Mechanics of materials solution manual (3 rd ed , by beer, johnston, & dewolf)
 

Similar a C# language basics (Visual Studio)

C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)sachindane
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in javaShashwat Shriparv
 
Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1Techglyphs
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysDevaKumari Vijay
 
1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdfJavier Crisostomo
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A ReviewFernando Torres
 
C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE jatin batra
 
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...GANESHBABUVelu
 
Data types and operators in vb
Data types and operators  in vbData types and operators  in vb
Data types and operators in vballdesign
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script TrainingsAli Imran
 
Looping statements
Looping statementsLooping statements
Looping statementsJaya Kumari
 
Introduction of C# BY Adarsh Singh
Introduction of C# BY Adarsh SinghIntroduction of C# BY Adarsh Singh
Introduction of C# BY Adarsh Singhsinghadarsh
 

Similar a C# language basics (Visual Studio) (20)

C Language (All Concept)
C Language (All Concept)C Language (All Concept)
C Language (All Concept)
 
Fundamental programming structures in java
Fundamental programming structures in javaFundamental programming structures in java
Fundamental programming structures in java
 
C# - Part 1
C# - Part 1C# - Part 1
C# - Part 1
 
VB Script Overview
VB Script OverviewVB Script Overview
VB Script Overview
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1
 
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arraysUnit 2-data types,Variables,Operators,Conitionals,loops and arrays
Unit 2-data types,Variables,Operators,Conitionals,loops and arrays
 
java notes.pdf
java notes.pdfjava notes.pdf
java notes.pdf
 
1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf1_1_python-course-notes-sections-1-7.pdf
1_1_python-course-notes-sections-1-7.pdf
 
unit 1 (1).pptx
unit 1 (1).pptxunit 1 (1).pptx
unit 1 (1).pptx
 
GUI Programming in JAVA (Using Netbeans) - A Review
GUI Programming in JAVA (Using Netbeans) -  A ReviewGUI Programming in JAVA (Using Netbeans) -  A Review
GUI Programming in JAVA (Using Netbeans) - A Review
 
C presentation! BATRA COMPUTER CENTRE
C presentation! BATRA  COMPUTER  CENTRE C presentation! BATRA  COMPUTER  CENTRE
C presentation! BATRA COMPUTER CENTRE
 
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
Java works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc.) I...
 
c# at f#
c# at f#c# at f#
c# at f#
 
C# AND F#
C# AND F#C# AND F#
C# AND F#
 
Data types and operators in vb
Data types and operators  in vbData types and operators  in vb
Data types and operators in vb
 
QTP VB Script Trainings
QTP VB Script TrainingsQTP VB Script Trainings
QTP VB Script Trainings
 
Intake 37 2
Intake 37 2Intake 37 2
Intake 37 2
 
Looping statements
Looping statementsLooping statements
Looping statements
 
Introduction of C# BY Adarsh Singh
Introduction of C# BY Adarsh SinghIntroduction of C# BY Adarsh Singh
Introduction of C# BY Adarsh Singh
 

Último

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 

Último (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

C# language basics (Visual Studio)

  • 1. Page 1 of 8  The first line of the program using System; the using keyword is used to include the System namespace in the program. A program generally has multiple using statements.  The next line has the namespace declaration. A namespace is a collection of classes. The “Hello World” Application namespace contains the class Hello World.  The next line has a class declaration, the class Hello World contains the data and method definitions that your program uses. Classes generally would contain more than one method. Methods define the behavior of the class. However, the Hello World class has only one method Main.  The next line defines the Main method, which is the entry point for all C# programs. The Main method states what the class will do when executed  The next line /*...*/ will be ignored by the compiler and it has been put to add additional comments in the program.  The Main method specifies its behavior with the statement Console.WriteLine("Hello World"); WriteLine is a method of the Console class defined in the System namespace. This statement causes the message "Hello, World!" to be displayed on the screen.  The last line Console.ReadKey(); is for the VS.NET Users. This makes the program wait for a key press and it prevents the screen from running and closing quickly when the program is launched from Visual Studio .NET. Its worth to naote the following points:  C# is case sensitive.  All statements and expression must end with a semicolon (;).  The program execution starts at the main method.  Unlike Java, file name could be different from the class name. C# Type Conversion Methods: C# provides the following built-in type conversion methods:
  • 2. Page 2 of 8 S.N Methods & Description 1 ToBoolean Converts a type to a Boolean value, where possible. 2 ToByte Converts a type to a byte. 3 ToChar Converts a type to a single Unicode character, where possible. 4 ToDateTime Converts a type (integer or string type) to date-time structures. 5 ToDecimal Converts a floating point or integer type to a decimal type. 6 ToDouble Converts a type to a double type. 7 ToInt16 Converts a type to a 16-bit integer. 8 ToInt32 Converts a type to a 32-bit integer. 9 ToInt64 Converts a type to a 64-bit integer. 10 ToSbyte Converts a type to a signed byte type. 11 ToSingle Converts a type to a small floating point number. 12 ToString Converts a type to a string. 13 ToType Converts a type to a specified type. 14 ToUInt16 Converts a type to an unsigned int type. 15 ToUInt32 Converts a type to an unsigned long type. 16 ToUInt64 Converts a type to an unsigned big integer.
  • 3. Page 3 of 8 Accepting Values from User: The Console class in the System namespace provides a function ReadLine() for accepting input from the user and store it into a variable. Arithmetic Operators: Operator Description Example + Adds two operands A + B will give 30 - Subtracts second operand from the first A - B will give -10 * Multiplies both operands A * B will give 200 / Divides numerator by de-numerator B / A will give 2 % Modulus Operator and remainder of after an integer division B % A will give 0 ++ Increment operator increases integer value by one A++ will give 11 -- Decrement operator decreases integer value by one A-- will give 9 Relational Operators: Operator Description Example == Checks if the values of two operands are equal or not, if yes then condition becomes true. (A == B) is not true. != Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (A != B) is true. > Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (A > B) is not true. < Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (A < B) is true. >= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (A >= B) is not true. <= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (A <= B) is true. Logical Operators:
  • 4. Page 4 of 8 Operator Description Example && Called Logical AND operator. If both the operands are non zero then condition becomes true. (A && B) is false. || Called Logical OR Operator. If any of the two operands is non zero then condition becomes true. (A || B) is true. ! Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false. !(A && B) is true. Conditions: Statement Description if statement An if statement consists of a boolean expression followed by one or more statements. if...else statement An if statement can be followed by an optional else statement, which executes when the boolean expression is false. nested if statements You can use one if or else if statement inside another if or else if statement(s). switch statement A switch statement allows a variable to be tested for equality against a list of values. nested switch statements You can use one switch statement inside another switchstatement(s). C# - Loops: A loop statement allows us to execute a statement or group of statements multiple times . Loop Type Description while loop Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body. for loop Executes a sequence of statements multiple times and abbreviates the code that manages the loop variable. do...while loop Like a while statement, except that it tests the condition at the end of the loop body nested loops You can use one or more loop inside any another while, for or do..while loop. Loop Control Statements:
  • 5. Page 5 of 8 Loop control statements change execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. Control Statement Description break statement Terminates the loop or switch statement and transfers execution to the statement immediately following the loop or switch. continue statement Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating. C# - Arrays: An array stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. Instead of declaring individual variables, such as number0, number1, ..., and number99, you declare one array variable such as numbers and use numbers[0], numbers[1], and ..., numbers[99] to represent individual variables. A specific element in an array is accessed by an index. Declaring Arrays: To declare an array in C#, you can use the following syntax: datatype[] arrayName; where,  datatype is used to specify the type of elements to be stored in the array.  [ ] specifies the rank of the array. The rank specifies the size of the array.  arrayName specifies the name of the array. For example, double[] balance; Initializing an Array Array is a reference type, so you need to use the new keyword to create an instance of the array. For example, double[] balance = new double[10];
  • 6. Page 6 of 8 Code Description abstract The abstract modifier can be used with classes, methods, properties, indexers, and events. as The as operator is used to perform conversions between compatible types. base The base keyword is used to access members of the base class from within a derived class bool The bool keyword is an alias of System.Boolean. It is used to declare variables to store the Boolean values, true and false. break The keyword break is used to exit out of a loop or switch block. byte It represents an 8-bit unsigned integer whose value ranges from 0 to 255. case case is often used in a switch statement. catch The keyword catch is used to identify a statement or statement block for execution char It represents a Unicode character whose from 0 to 65,535. checked The checked keyword is used to control the overflow-checking context for integral-type arithmetic operations and conversions. class The class keyword is used to declare a class. const The const keyword is used in field and local variable declarations to make the variable constant continue Its affect is to end the current loop and proceed to the next one. decimal The decimal keyword denotes a 128-bit data type. default The default keyword can be used in the switch statement delegate The delegate keyword is used to declare a delegate. A delegate is a programming construct that is used to obtain a callable reference to a method of a class. do The do statement executes a statement or a block of statements repeatedly until a specified expression evaluates to false. double The double keyword denotes a simple type that stores 64-bit floating-point values. else An else clause immediately follows an if-body. It provides code to execute when the condition is false. enum The enum keyword is used to declare an enumeration, a distinct type consisting of a set of named constants called the enumerator list. event It is used to declare an event. explicit The explicit keyword is used to declare an explicit user-defined type conversion operator extern Use the extern modifier in a method declaration to indicate that the method is implemented externally. false The false keyword is a boolean constant value finally The finally block is useful for cleaning up any resources allocated in the try block. fixed Prevents relocation of a variable by the garbage collector. float The float keyword denotes a simple type that stores 32-bit floating-point values. for The for loop executes a statement or a block of statements repeatedly until a specified expression evaluates to false. foreach The foreach statement repeats a group of embedded statements for each element in an array or an object collection.
  • 7. Page 7 of 8 goto The goto statement transfers the program control directly to a labeled statement. if The if statement selects a statement for execution based on the value of a Boolean expression. implicit The implicit keyword is used to declare an implicit user-defined type conversion operator. in The in keyword identifies the collection to enumerate in a foreach loop. int The int keyword denotes an integral type that stores values according to the size and range interface The interface keyword is used to declare an interface. Interfaces provide a construct for a programmer to create types that can have methods, properties, delegates, events, and indexers declared, but not implemented. internal The internal keyword is an access modifier for types and type members. That is, it is only visible within the assembly that implements it. is The is operator is used to check whether the run-time type of an object is compatible with a given type. Using is on a null variable always returns false. lock The lock keyword marks a statement block as a critical section by obtaining the mutual- exclusion lock for a given object, executing a statement, and then releasing the lock. long The long keyword denotes an integral type that stores values according to the size and range.That is, it represents a 64-bit signed integer whose value ranges from - 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. namespace The namespace keyword is used to supply a namespace for class, structure, and type declarations. new In C#, the new keyword can be used as an operator or as a modifier. null The null keyword is a literal that represents a null reference, one that does not refer to any object. object It represents the base class from which all other reference types derive. operator The operator keyword is used to declare an operator in a class or struct declaration. out The out method parameter keyword on a method parameter causes a method to refer to the same variable that was passed into the method override Use the override modifier to modify a method, a property, an indexer, or an event. params The keyword params is used to describe when a grouping of parameters are passed to a method, but the number of parameters are not important, as they may vary. private To make the field, method, or property private to its enclosing class. That is, it is not visible outside of its class. protected To make the field, method, or property protected to its enclosing class. That is, it is not visible outside of its class. public To make the field, method, or property public to its enclosing class. That is, it is visible from any class. readonly The readonly keyword is a modifier that you can use on fields. ref The ref keyword explicitely specifies that a variable should be passed by reference rather than by value. return The return statement terminates execution of the method in which it appears and returns
  • 8. Page 8 of 8 control to the calling method. sbyte It represents an 8-bit signed integer whose value ranges from -128 to 127. sealed A sealed class cannot be inherited. short It represents a 16-bit signed integer whose value ranges from -32,768 to 32,767. sizeof The sizeof keyword returns how many bytes an object requires to be stored. stackalloc Allocates a block of memory on the stack. static Use the static modifier to declare a static member, which belongs to the type itself rather than to a specific object. string The string type represents a string of Unicode characters. struct A struct type is a value type that can contain constructors, constants, fields, methods, properties, indexers, operators, events, and nested types. switch The switch statement is a control statement that handles multiple selections by passing control to one of the case statements within its body. this The this keyword refers to the current instance of the class. Static member functions do not have a this pointer. throw The throw statement is used to signal the occurrence of an anomalous situation (exception) during the program execution. true In C#, the true keyword can be used as an overloaded operator or as a literal. try The try-catch statement consists of a try block followed by one or more catchclauses, which specify handlers for different exceptions. typeof The typeof operator is used to obtain the System.Type object for a type. uint The uint keyword denotes an integral type that stores values according to the size and range shown in the following table. ulong The ulong keyword denotes an integral type that stores values according to the size and range shown in the following table. unchecked The unchecked keyword is used to control the overflow-checking context for integral- type arithmetic operations and conversions. unsafe The unsafe keyword denotes an unsafe context, which is required for any operation involving pointers. ushort The ushort keyword denotes an integral data type that stores values according to the size and range shown in the following table. using The using keyword has two major uses. virtual The virtual keyword is used to modify a method or property declaration, in which case the method or the property is called a virtual member. volatile The volatile keyword indicates that a field can be modified in the program by something such as the operating system, the hardware, or a concurrently executing thread. void When used as the return type for a method, void specifies that the method does not return a value. while The while statement executes a statement or a block of statements until a specified expression evaluates to false.