/**
 * Given a list and an item to remove, remove all occurrences of the item from the list.
 * Use the break and continue statements to solve the exercise.
 */
fun removeFromList(listItems: MutableList<Any>, itemToRemove: Any): List<Any> {

    // Iterate through each item in the list
    val iterator = listItems.iterator()
    while (iterator.hasNext()) {
        val item = iterator.next()
        // Place your code here to check if the current item is equal to the itemToRemove.
        // If they are equal, use the continue statement to skip the rest of the iteration.
        

        // Place your code here to remove the item from the list using the remove() method.
        // Hint: Use the try-catch block to handle the situation when an item to be removed
        // is not found in the list. In this case, use the continue statement to skip the rest of the iteration.
        

        // Place your code here to break out of the loop when all occurrences of the item are removed.
        // Hint: Check if the index of the current item is equal to the last index of the list.
        
    }
    return listItems
}
/**
 * Given a list and an item to remove, remove all occurrences of the item from the list.
 * Use the break and continue statements to solve the exercise.
 */
fun removeFromList(listItems: MutableList<Any>, itemToRemove: Any): List<Any> {
/**
 * Given a list and an item to remove, remove all occurrences of the item from the list.
 * Use the break and continue statements to solve the exercise.
 */
fun removeFromList(listItems: MutableList<Any>, itemToRemove: Any): List<Any> {

    // Iterate through each item in the list
    val iterator = listItems.iterator()
    while (iterator.hasNext()) {
        val item = iterator.next()
        // Place your code here to check if the current item is equal to the itemToRemove.
        // If they are equal, use the continue statement to skip the rest of the iteration.
        

        // Place your code here to remove the item from the list using the remove() method.
        // Hint: Use the try-catch block to handle the situation when an item to be removed
        // is not found in the list. In this case, use the continue statement to skip the rest of the iteration.
        

        // Place your code here to break out of the loop when all occurrences of the item are removed.
        // Hint: Check if the index of the current item is equal to the last index of the list.
        
    }
    return listItems
}