# 1. Define a method named "safe_division" that takes two parameters, dividend and divisor.
# 2. Use a conditional statement to check if the divisor is zero.
# 3. If the divisor is zero, return nil to indicate an undefined result.
# 4. If the divisor is not zero, perform the division operation and return the result.
def safe_division(dividend, divisor)
return nil if divisor.zero?
dividend / divisor
end
# Example Usage:
# 5. Call the safe_division method with appropriate values.
result = safe_division(10, 2) # Result: 5
undefined_result = safe_division(10, 0) # Result: nil