/**
 * This function takes a list of numbers and a target value as arguments.
 * It deletes all occurrences of the target value in the list and then exits the while loop.
 * The modified list is returned as the final output.
 */
fun removeElements(nums: MutableList<Int>, target: Int): List<Int> {

    var i = 0
    while (i < nums.size) {
        if (nums[i] == target) {
            nums.removeAt(i)
            continue
        }
        i++
    }
    return nums
}

// Example usage
/**
 * This function takes a list of numbers and a target value as arguments.
 * It deletes all occurrences of the target value in the list and then exits the while loop.
 * The modified list is returned as the final output.
 */
fun removeElements(nums: MutableList<Int>, target: Int): List<Int> {
/**
 * This function takes a list of numbers and a target value as arguments.
 * It deletes all occurrences of the target value in the list and then exits the while loop.
 * The modified list is returned as the final output.
 */
fun removeElements(nums: MutableList<Int>, target: Int): List<Int> {

    var i = 0
    while (i < nums.size) {
        if (nums[i] == target) {
            nums.removeAt(i)
            continue
        }
        i++
    }
    return nums
}

// Example usage