[Solved] Codewars – Swift Solution (Multiply Function)


Edit: in newer versions of Swift, OP’s code works too, since return is no longer needed if there is only oneexpression in the body of a funcion/variable. Details here.


You are not doing anything with the result.

-> Double indicates that this function should return a Double. For that, you should use the return keyword:

func multiply(_ a: Double, _ b: Double) -> Double {
    return a * b
}

0

solved Codewars – Swift Solution (Multiply Function)