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

distinguish value1 and value2 #386

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/scala/stdlib/Options.scala
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,18 @@ object Options extends AnyFlatSpec with Matchers with org.scalaexercises.definit
*/
def matchOptions(res0: Double, res1: Double) = {
val someValue: Option[Double] = Some(20.0)
val value = someValue match {
val value1 = someValue match {
case Some(v) => v
case None => 0.0
}
value should be(res0)
value1 should be(res0)

val noValue: Option[Double] = None
val value1 = noValue match {
val value2 = noValue match {
case Some(v) => v
case None => 0.0
}
value1 should be(res1)
value2 should be(res1)
}

/**
Expand Down