/**
 * This function updates the pattern in a fashion designer's design.
 *
 * @param patterns List of existing patterns in the design.
 * @param newPattern New pattern to be added.
 * @param design Name of the design.
 * @return A tuple containing the updated patterns list and the updated design name.
 */
fun updatePattern(patterns: MutableList<String>, newPattern: String, design: String): Pair<MutableList<String>, String> {

    // Iterate through each pattern in the list
    for ((index, pattern) in patterns.withIndex()) {
        // Check if the pattern matches the current design name
        if (pattern == design) {
            // Update the pattern with the new pattern
            patterns[index] = newPattern
            // Break the loop as we have found and updated the desired pattern
            break
        }
    }
    // Return the updated patterns list and the design name
    return Pair(patterns, design)
}

// Example usage
/**
 * This function updates the pattern in a fashion designer's design.
 *
 * @param patterns List of existing patterns in the design.
 * @param newPattern New pattern to be added.
 * @param design Name of the design.
 * @return A tuple containing the updated patterns list and the updated design name.
 */
fun updatePattern(patterns: MutableList<String>, newPattern: String, design: String): Pair<MutableList<String>, String> {
/**
 * This function updates the pattern in a fashion designer's design.
 *
 * @param patterns List of existing patterns in the design.
 * @param newPattern New pattern to be added.
 * @param design Name of the design.
 * @return A tuple containing the updated patterns list and the updated design name.
 */
fun updatePattern(patterns: MutableList<String>, newPattern: String, design: String): Pair<MutableList<String>, String> {

    // Iterate through each pattern in the list
    for ((index, pattern) in patterns.withIndex()) {
        // Check if the pattern matches the current design name
        if (pattern == design) {
            // Update the pattern with the new pattern
            patterns[index] = newPattern
            // Break the loop as we have found and updated the desired pattern
            break
        }
    }
    // Return the updated patterns list and the design name
    return Pair(patterns, design)
}

// Example usage