/**
 * Given a list of transactions and an initial balance, this function returns the final balance
 * after applying all the transactions to the initial_balance.
 *
 * Each element in the list can either be a positive or negative number, indicating a credit or
 * debit transaction respectively.
 *
 * @param transactions A list of transactions.
 * @param initialBalance The initial balance.
 * @return The final balance after applying all the transactions.
 *
 * Example:
 * calculateBalance(listOf(100, -50, 200, -75), 500) returns 675.0
 */
fun calculateBalance(transactions: List<Double>, initialBalance: Double): Double {

    var balance = initialBalance

    // Iterate through each transaction in the list
    for (transaction in transactions) {
        // Modify the balance by applying the transaction to it
        balance += transaction
    }

    return balance
}
/**
 * Given a list of transactions and an initial balance, this function returns the final balance
 * after applying all the transactions to the initial_balance.
 *
 * Each element in the list can either be a positive or negative number, indicating a credit or
 * debit transaction respectively.
 *
 * @param transactions A list of transactions.
 * @param initialBalance The initial balance.
 * @return The final balance after applying all the transactions.
 *
 * Example:
 * calculateBalance(listOf(100, -50, 200, -75), 500) returns 675.0
 */
fun calculateBalance(transactions: List<Double>, initialBalance: Double): Double {
/**
 * Given a list of transactions and an initial balance, this function returns the final balance
 * after applying all the transactions to the initial_balance.
 *
 * Each element in the list can either be a positive or negative number, indicating a credit or
 * debit transaction respectively.
 *
 * @param transactions A list of transactions.
 * @param initialBalance The initial balance.
 * @return The final balance after applying all the transactions.
 *
 * Example:
 * calculateBalance(listOf(100, -50, 200, -75), 500) returns 675.0
 */
fun calculateBalance(transactions: List<Double>, initialBalance: Double): Double {

    var balance = initialBalance

    // Iterate through each transaction in the list
    for (transaction in transactions) {
        // Modify the balance by applying the transaction to it
        balance += transaction
    }

    return balance
}