From 86d11098e0f6436d250a13f28326dd801a76fe6f Mon Sep 17 00:00:00 2001 From: TH Lim Date: Mon, 22 May 2023 22:57:43 +0800 Subject: [PATCH] Remove if-else syntax for readability --- _overviews/scala3-book/ca-multiversal-equality.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/_overviews/scala3-book/ca-multiversal-equality.md b/_overviews/scala3-book/ca-multiversal-equality.md index 7d5d6d0c92..2e3308d25b 100644 --- a/_overviews/scala3-book/ca-multiversal-equality.md +++ b/_overviews/scala3-book/ca-multiversal-equality.md @@ -175,14 +175,12 @@ case class AudioBook( // override to allow AudioBook to be compared to PrintedBook override def equals(that: Any): Boolean = that match case a: AudioBook => - if this.author == a.author + this.author == a.author && this.title == a.title && this.year == a.year && this.lengthInMinutes == a.lengthInMinutes - then true else false case p: PrintedBook => - if this.author == p.author && this.title == p.title - then true else false + this.author == p.author && this.title == p.title case _ => false ```