You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In these examples, I think you intended to use parenthesis in your return statement (i.e. return (a+b) / 2.0) but since you didn't, then the actual result for both examples (see below) are wrong:
{ (a: Double, b: Double) -> Double in
return a + b / 2.0
}(10.0, 15.0)
// => 12.5 <- this is wrong, given the code
...
let mean = { (a: Double, b: Double) -> Double in
a + b / 2.0
}
mean(13.0, 100.0)
// => 56.5 <- this is wrong, given the code
The text was updated successfully, but these errors were encountered:
Hi András,Yes, that link is correct. However, I found the exercise at:Double-Null0111: Closures Are Forever in Swift on Exercismexercism.orgThis is the exercise for the swift track on exercism.org. The article title is: Double-Null0111: Closures Are Forever.Hope that helps?DavidOn Dec 5, 2024, at 6:44 PM, András B Nagy ***@***.***> wrote:
Which exercise is this for? https://github.com/exercism/swift/blob/main/exercises/concept/bomb-defuser/.docs/introduction.md?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
In these examples, I think you intended to use parenthesis in your return statement (i.e. return (a+b) / 2.0) but since you didn't, then the actual result for both examples (see below) are wrong:
{ (a: Double, b: Double) -> Double in
return a + b / 2.0
}(10.0, 15.0)
// => 12.5 <- this is wrong, given the code
...
let mean = { (a: Double, b: Double) -> Double in
a + b / 2.0
}
mean(13.0, 100.0)
// => 56.5 <- this is wrong, given the code
The text was updated successfully, but these errors were encountered: