/**
 * This function is used to subtract a note from a given scale using a subtraction assignment operator.
 *
 * @param scale The scale from which the note should be subtracted.
 * @param note The note to be subtracted from the scale.
 * @param loopCondition The boolean expression that should be evaluated in the loop.
 * @return The updated scale after subtracting the note.
 */
fun subtractNoteFromScale(scale: MutableList<String>, note: String, loopCondition: () -> Boolean): List<String> {

    var index = 0
    var scaleLength = scale.size

    while (loopCondition()) {
        if (index >= scaleLength) {
            break
        }

        if (scale[index] == note) {
            scale.removeAt(index)
            scaleLength--
        }

        index++
    }

    return scale
}

// Example usage
/**
 * This function is used to subtract a note from a given scale using a subtraction assignment operator.
 *
 * @param scale The scale from which the note should be subtracted.
 * @param note The note to be subtracted from the scale.
 * @param loopCondition The boolean expression that should be evaluated in the loop.
 * @return The updated scale after subtracting the note.
 */
fun subtractNoteFromScale(scale: MutableList<String>, note: String, loopCondition: () -> Boolean): List<String> {
/**
 * This function is used to subtract a note from a given scale using a subtraction assignment operator.
 *
 * @param scale The scale from which the note should be subtracted.
 * @param note The note to be subtracted from the scale.
 * @param loopCondition The boolean expression that should be evaluated in the loop.
 * @return The updated scale after subtracting the note.
 */
fun subtractNoteFromScale(scale: MutableList<String>, note: String, loopCondition: () -> Boolean): List<String> {

    var index = 0
    var scaleLength = scale.size

    while (loopCondition()) {
        if (index >= scaleLength) {
            break
        }

        if (scale[index] == note) {
            scale.removeAt(index)
            scaleLength--
        }

        index++
    }

    return scale
}

// Example usage