Forum : How to use the foreach loop ?
Brief description  about Online courses   join in Online courses
View Arun  Desai 's Profile

How to use the foreach loop ?

foreach loop......
Asked by Arun Desai | Mar 17, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi Arun,
The Foreach loop is a variation of the For loop and allows you to iterate over elements in an array. There are two different versions of the Foreach loop. The Foreach loop syntaxes are as follows:
foreach (array as value)
{
code to be executed;
}

foreach (array as key => value)
{
code to be executed;
}
Mar 17, 2010