Lec 2
Lec 2
PROGRAMING
Next Topic
Array
Loops
String concatenation
Case Sensitives
Casting ( Conversion )
* Scopes
FUNDAMENTALS OF
PROGRAMING
Arrays are used to store multiple values in a single variable, instead of declaring separate
variables for each value.
To declare an array, define the variable type with square brackets []
Arrays are used to store multiple values in a single variable, instead of declaring separate
variables for each value. To declare an array, define the variable
// declare an array
int[] age;
string[] cars;
string[] cars = {“mehran", “alto", “Toyota", “city"};
Console.WriteLine(cars[0]);
FUNDAMENTALS OF
PROGRAMING
// Create an array of four elements, and add values later
string[] cars = new string[4];
Loops
1.For
2.Foreach
3.While
4.Do While
FUNDAMENTALS OF
PROGRAMING
for (initialization; condition; iterator)
{
// body of for loop
}