Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double-Null0111 exercise README has incorrect results in the examples #780

Open
djlamm opened this issue Dec 6, 2024 · 2 comments
Open

Comments

@djlamm
Copy link

djlamm commented Dec 6, 2024

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

@BNAndras
Copy link
Member

BNAndras commented Dec 6, 2024

@djlamm
Copy link
Author

djlamm commented Dec 6, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants