/**
 * A carpenter is working on creating a rectangular board with two different widths and lengths.
 * This function calculates the length of the board based on the given widths and lengths.
 * The final length will be the sum of both lengths if both widths are positive.
 * If either of the widths is negative, the final length will be the difference between both lengths.
 *
 * @param width1 Integer value representing the first width of the board.
 * @param width2 Integer value representing the second width of the board.
 * @param length1 Integer value representing the first length of the board.
 * @param length2 Integer value representing the second length of the board.
 * @return Integer value representing the calculated length of the board.
 */
fun calculateBoardLength(width1: Int, width2: Int, length1: Int, length2: Int): Int {

    return if (width1 >= 0 && width2 >= 0) {
        length1 + length2
    } else {
        length2 - length1
    }
}
/**
 * A carpenter is working on creating a rectangular board with two different widths and lengths.
 * This function calculates the length of the board based on the given widths and lengths.
 * The final length will be the sum of both lengths if both widths are positive.
 * If either of the widths is negative, the final length will be the difference between both lengths.
 *
 * @param width1 Integer value representing the first width of the board.
 * @param width2 Integer value representing the second width of the board.
 * @param length1 Integer value representing the first length of the board.
 * @param length2 Integer value representing the second length of the board.
 * @return Integer value representing the calculated length of the board.
 */
fun calculateBoardLength(width1: Int, width2: Int, length1: Int, length2: Int): Int {
/**
 * A carpenter is working on creating a rectangular board with two different widths and lengths.
 * This function calculates the length of the board based on the given widths and lengths.
 * The final length will be the sum of both lengths if both widths are positive.
 * If either of the widths is negative, the final length will be the difference between both lengths.
 *
 * @param width1 Integer value representing the first width of the board.
 * @param width2 Integer value representing the second width of the board.
 * @param length1 Integer value representing the first length of the board.
 * @param length2 Integer value representing the second length of the board.
 * @return Integer value representing the calculated length of the board.
 */
fun calculateBoardLength(width1: Int, width2: Int, length1: Int, length2: Int): Int {

    return if (width1 >= 0 && width2 >= 0) {
        length1 + length2
    } else {
        length2 - length1
    }
}