Skip to content

Conversation

@emma-burrows
Copy link
Contributor

Just a little tweak to make it clearer to beginners that getOrElse will return the wrapped value if the Option is a Some, and the provided default value if it is None (since there seemed to be some confusion in the comments on this section).

@FRosner
Copy link
Member

FRosner commented Jun 7, 2018

Thanks for the PR @emma-burrows. Sorry I didn't respond earlier I was a bit busy.

* }}}
*
* Using `getOrElse` we can provide a default value ("No value") when the optional argument (`None`) does not exist:
* Using `getOrElse`, we can extract the value if the `Option[A]` is a `Some[A]`, and provide a default value ("No value") when the optional argument (`None`) does not exist:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the whole sentence is a bit clumsy.

Maybe we can rewrite it to something like this:

Using getOrElse, we can extract the value if it exists, or return a provided default value. If we have a Some(x) we can return x, and for None we return the default value.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think in general, more numerous, shorter sentences are best. I'll update the PR as suggested.

@FRosner
Copy link
Member

FRosner commented Jun 7, 2018

Thanks a lot! I'm gonna wait until tomorrow if someone else has any feedback. Otherwise I'll merge it :)

@FRosner FRosner merged commit 0fdc520 into scala-exercises:master Jun 8, 2018
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

Successfully merging this pull request may close these issues.

2 participants