From 2d0a124200a24e3b1c2ed6574a6d970fe96c5557 Mon Sep 17 00:00:00 2001 From: Pablo Arranz Ropero Date: Sun, 2 Jun 2019 12:39:53 +0200 Subject: some more tanslated --- es-es/scala.html.markdown | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/es-es/scala.html.markdown b/es-es/scala.html.markdown index f314bc9e..1d09add0 100644 --- a/es-es/scala.html.markdown +++ b/es-es/scala.html.markdown @@ -245,23 +245,22 @@ sumarUno(5) // => 6 sumaRara(2, 4) // => 16 -// The return keyword exists in Scala, but it only returns from the inner-most -// def that surrounds it. -// WARNING: Using return in Scala is error-prone and should be avoided. -// It has no effect on anonymous functions. For example: +// La palabra return existe en Scala, pero solo retorna desde la función más interna que la rodea. +// ADVERTENCIA: Usar return en Scala puede inducir a errores y debe ser evitado +// No tiene efecto en funciones anónimas. Por ejemplo: def foo(x: Int): Int = { - val anonFunc: Int => Int = { z => + val funcAnon: Int => Int = { z => if (z > 5) - return z // This line makes z the return value of foo! + return z // Esta línea hace que z sea el valor de retorno de foo! else - z + 2 // This line is the return value of anonFunc + z + 2 // Esta línea es el valor de retorno de funcAnon } - anonFunc(x) // This line is the return value of foo + anonFunc(x) // Esta línea es el valor de retorno de foo } ///////////////////////////////////////////////// -// 3. Flow Control +// 3. Control del flujo ///////////////////////////////////////////////// 1 to 5 -- cgit v1.2.3