
Integer[] myList = new List<Integer>();
//Adds a new element with value 10 to the end of the list
myList.add(10);
myList.add(11);
for (Integer i=0; i<=myList.size; i++)
System.debug(' element in the array using myList[0] is ' + i);
whats the problem in this code
1 comment
try (System.debug(' element in the array using myList[0] is ' + myList[i]);) to get the values u have added,
for (Integer i=0; i<=myList.size; i++)
System.debug(' element in the array using myList[0] is ' + i); will print the indexes(0 and 1) not the index values of the list.