The following procedure is intended to return the number of times the value val appears in the list myList. The procedure does not work as intended.
- Line 1: PROCEDURE countNumOccurences(myList, val)
- Line 2: {
- Line 3: FOR EACH item IN myList
- Line 4: {
- Line 5: count ← 0
- Line 6: IF(item = val)
- Line 7: {
- Line 8: count ← count + 1
- Line 9: }
- Line 10: }
- Line 11: RETURN(count)
- Line 12: }
Which of the following changes can be made so that the procedure will work as intended?