/**
 * Create a function that calculates the resistance of an electrical circuit.
 *
 * The function should take two arguments:
 * - voltage: the voltage across the circuit (in volts)
 * - current: the current flowing through the circuit (in amperes)
 *
 * The resistance, measured in ohms, can be calculated using Ohm's Law:
 * resistance = voltage / current
 *
 * However, there are two scenarios that you need to consider:
 * 1. If either the voltage or current is zero, the resistance should be considered infinite.
 * 2. If both the voltage and current are non-zero, calculate the resistance using Ohm's Law.
 *
 * Your task is to complete the function below and handle these scenarios using short-circuiting
 * with if-else statements.
 */
fun calculateResistance(voltage: Double, current: Double): Double {

    var resistance: Double

    // Handle the scenarios using short-circuiting with if-else statements
    resistance = if (voltage == 0.0 || current == 0.0) {
        Double.POSITIVE_INFINITY
    } else {
        voltage / current
    }

    return resistance
}
/**
 * Create a function that calculates the resistance of an electrical circuit.
 *
 * The function should take two arguments:
 * - voltage: the voltage across the circuit (in volts)
 * - current: the current flowing through the circuit (in amperes)
 *
 * The resistance, measured in ohms, can be calculated using Ohm's Law:
 * resistance = voltage / current
 *
 * However, there are two scenarios that you need to consider:
 * 1. If either the voltage or current is zero, the resistance should be considered infinite.
 * 2. If both the voltage and current are non-zero, calculate the resistance using Ohm's Law.
 *
 * Your task is to complete the function below and handle these scenarios using short-circuiting
 * with if-else statements.
 */
fun calculateResistance(voltage: Double, current: Double): Double {
/**
 * Create a function that calculates the resistance of an electrical circuit.
 *
 * The function should take two arguments:
 * - voltage: the voltage across the circuit (in volts)
 * - current: the current flowing through the circuit (in amperes)
 *
 * The resistance, measured in ohms, can be calculated using Ohm's Law:
 * resistance = voltage / current
 *
 * However, there are two scenarios that you need to consider:
 * 1. If either the voltage or current is zero, the resistance should be considered infinite.
 * 2. If both the voltage and current are non-zero, calculate the resistance using Ohm's Law.
 *
 * Your task is to complete the function below and handle these scenarios using short-circuiting
 * with if-else statements.
 */
fun calculateResistance(voltage: Double, current: Double): Double {

    var resistance: Double

    // Handle the scenarios using short-circuiting with if-else statements
    resistance = if (voltage == 0.0 || current == 0.0) {
        Double.POSITIVE_INFINITY
    } else {
        voltage / current
    }

    return resistance
}