Answers for "what loop can you use to traverse through a list"

2

iterate through a list

my_list = ["Hello", "World"]
for i in my_list:
  print(i)
Posted by: Guest on November-30-2020
0

how to loop through a list

List<int> list = new List<int> { 1, 2, 3, 4, 5 };
//For Loop
for (int i = 0; i < list.Count(); i++)
{ Console.WriteLine(list[i]); }

//For Each Loop
foreach (int item in list)
{ Console.WriteLine(item); }
Posted by: Guest on January-11-2021

Code answers related to "what loop can you use to traverse through a list"

Python Answers by Framework

Browse Popular Code Answers by Language