/**
 * The function finds the index of a target product in a given list of products.
 * It uses an infinite while loop to repeatedly prompt the user for the name of a product.
 * Once the target product is found, it returns the index of the product.
 * If the target product is not present in the list, it returns -1.
 */
fun findProduct(products: List<String>, target: String): Int {

    var index = 0
    while (true) {
        print("Enter a product name: ")
        val product = readLine()
        if (product == target) {
            return index
        } else if (products.contains(product)) {
            index = products.indexOf(product)
        } else {
            println("Product not found!")
            break
        }
    }
    return -1
}
/**
 * The function finds the index of a target product in a given list of products.
 * It uses an infinite while loop to repeatedly prompt the user for the name of a product.
 * Once the target product is found, it returns the index of the product.
 * If the target product is not present in the list, it returns -1.
 */
fun findProduct(products: List<String>, target: String): Int {
/**
 * The function finds the index of a target product in a given list of products.
 * It uses an infinite while loop to repeatedly prompt the user for the name of a product.
 * Once the target product is found, it returns the index of the product.
 * If the target product is not present in the list, it returns -1.
 */
fun findProduct(products: List<String>, target: String): Int {

    var index = 0
    while (true) {
        print("Enter a product name: ")
        val product = readLine()
        if (product == target) {
            return index
        } else if (products.contains(product)) {
            index = products.indexOf(product)
        } else {
            println("Product not found!")
            break
        }
    }
    return -1
}