0% found this document useful (0 votes)
13 views3 pages

11# FOR - EACH Loop BREAK

Uploaded by

Lesunter KLter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

11# FOR - EACH Loop BREAK

Uploaded by

Lesunter KLter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

11# FOR - EACH Loop BREAK

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[] names = { "David", "Alenere", "Jasfer", "Ace", "Patrick",
"Jaymar", "Emman", "Ricardo", "Hezel" };

foreach (string x in names)


{
Console.WriteLine(x);
}
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[] names = { "David", "Alenere", "Jasfer", "Ace", "Patrick",
"Jaymar", "Emman", "Ricardo", "Hezel" };

foreach (string x in names)


{
if (x.Equals("Ace"))
{
Console.WriteLine("We Found : " + x);
break;
}
else
{
Console.WriteLine(x);
}
}
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
int[] numbers = { 1, 2, 3, 4, 5 };
int total = 0;

foreach (int num in numbers)


{
total += num;
}
Console.WriteLine("Total : " + total);
}
}
}

You might also like