for loop string in c#

83

for loop string in c# -

// Version 1: use foreach-loop.
foreach (char c in value)
{
	Console.WriteLine(c);
}
       
// Version 2: use for-loop.
for (int i = 0; i < value.Length; i++)
{
	Console.WriteLine(value[i]);
}

Comments

Submit
0 Comments