From 75911cadc95c69b607dd95232cec1a983904c1b4 Mon Sep 17 00:00:00 2001 From: Geravant Date: Tue, 18 Jun 2019 15:14:52 +0300 Subject: [PATCH] Structuring Information - Sealed Traits: task.md fixed formatting --- .../Defining Alternatives With Sealed Traits/task.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Structuring Information/Defining Alternatives With Sealed Traits/task.md b/Structuring Information/Defining Alternatives With Sealed Traits/task.md index 4122561..9fc34cd 100644 --- a/Structuring Information/Defining Alternatives With Sealed Traits/task.md +++ b/Structuring Information/Defining Alternatives With Sealed Traits/task.md @@ -70,9 +70,9 @@ Having defined `Symbol` as a sealed trait gives us the guarantee that the possible case of symbols is fixed. The compiler can leverage this knowledge to warn us if we write code that does not handle *all* the cases: -{{{ +```scala def unexhaustive(): Unit = { -sealed trait Symbol + sealed trait Symbol case class Note(name: String, duration: String, octave: Int) extends Symbol case class Rest(duration: String) extends Symbol @@ -81,8 +81,7 @@ def nonExhaustiveDuration(symbol: Symbol): String = case Rest(duration) => duration } } -}} - +``` If we try to run the above code to see how the compiler informs us that we don’t handle all the cases in `nonExhaustiveDuration`.