From ce7aa31cb7cb582bcff534b741420508c49509c6 Mon Sep 17 00:00:00 2001 From: Joe Littlejohn Date: Sun, 17 May 2020 21:52:21 +0100 Subject: [PATCH] Tidy comments in ByNameParameter.scala --- src/main/scala/stdlib/ByNameParameter.scala | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/scala/stdlib/ByNameParameter.scala b/src/main/scala/stdlib/ByNameParameter.scala index 01c1fd76..b78f3436 100644 --- a/src/main/scala/stdlib/ByNameParameter.scala +++ b/src/main/scala/stdlib/ByNameParameter.scala @@ -31,13 +31,13 @@ object ByNameParameter def takesUnitByNameParameter(res0: Either[Throwable, Int]) = { def calc(x: () => Int): Either[Throwable, Int] = { try { - Right(x()) //An explicit call of the x function + Right(x()) // An explicit call of the x function } catch { case b: Throwable => Left(b) } } - val y = calc { () => //Having explicitly declaring that Unit is a parameter with () + val y = calc { () => // explicitly declaring that Unit is a parameter with () 14 + 15 } @@ -48,7 +48,7 @@ object ByNameParameter */ def byNameParameter(res0: Either[Throwable, Int]) = { def calc(x: => Int): Either[Throwable, Int] = { - //x is a call by name parameter + // x is a call by-name parameter try { Right(x) } catch { @@ -57,16 +57,16 @@ object ByNameParameter } val y = calc { - //This looks like a natural block - println("Here we go!") //Some superfluous call - val z = List(1, 2, 3, 4) //Another superfluous call + // This looks like a natural block + println("Here we go!") // Some superfluous call + val z = List(1, 2, 3, 4) // Another superfluous call 49 + 20 } y should be(res0) } - /** By name parameters can also be used with `object` and `apply` to make interesting block-like calls: + /** By-name parameters can also be used with `object` and `apply` to make interesting block-like calls: */ def withApplyByNameParameter(res0: String) = { object PigLatinizer {