From 4fea893b013eb403fb3d0e158c3c28b14355d541 Mon Sep 17 00:00:00 2001 From: Rodolfo Forte Date: Mon, 18 Dec 2017 18:16:30 -0200 Subject: [PATCH] Update info about importing math.abs Update info about importing math.abs --- src/main/scala/scalatutorial/sections/FunctionalLoops.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/scala/scalatutorial/sections/FunctionalLoops.scala b/src/main/scala/scalatutorial/sections/FunctionalLoops.scala index c7678da0..036d6e8a 100644 --- a/src/main/scala/scalatutorial/sections/FunctionalLoops.scala +++ b/src/main/scala/scalatutorial/sections/FunctionalLoops.scala @@ -109,9 +109,12 @@ object FunctionalLoops extends ScalaTutorialSection { * (guess + x / guess) / 2 * * def isGoodEnough(guess: Double, x: Double) = - * abs(guess * guess - x) < 0.001 + * math.abs(guess * guess - x) < 0.001 * }}} * + * If we don't want to repeat math.abs every time we use it, we can call `import math.abs` + * at the beginning of the file, and from then on call `abs` directly. + * * Third, we define the `sqrt` function: * * {{{