/**
 * This function takes a list of numbers (nums) and a target number, and appends each number in the list to a new list until the target number is reached. If the target number is encountered in the original list, the iteration should stop using the break statement. If the number is negative, it should be skipped using the continue statement. Finally, the new list should be returned.
 */
fun appendToList(nums: List<Int>, target: Int): List<Int> {

    val newList = mutableListOf<Int>()

    for (num in nums) {
        if (num < 0) {
            continue
        }
        newList.add(num)
        if (num == target) {
            break
        }
    }

    return newList
}
/**
 * This function takes a list of numbers (nums) and a target number, and appends each number in the list to a new list until the target number is reached. If the target number is encountered in the original list, the iteration should stop using the break statement. If the number is negative, it should be skipped using the continue statement. Finally, the new list should be returned.
 */
fun appendToList(nums: List<Int>, target: Int): List<Int> {
/**
 * This function takes a list of numbers (nums) and a target number, and appends each number in the list to a new list until the target number is reached. If the target number is encountered in the original list, the iteration should stop using the break statement. If the number is negative, it should be skipped using the continue statement. Finally, the new list should be returned.
 */
fun appendToList(nums: List<Int>, target: Int): List<Int> {

    val newList = mutableListOf<Int>()

    for (num in nums) {
        if (num < 0) {
            continue
        }
        newList.add(num)
        if (num == target) {
            break
        }
    }

    return newList
}