summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPablo Arranz Ropero <arranzropablo@gmail.com>2019-06-02 12:39:53 +0200
committerPablo Arranz Ropero <arranzropablo@gmail.com>2019-06-02 12:39:53 +0200
commit2d0a124200a24e3b1c2ed6574a6d970fe96c5557 (patch)
treed91351785f29a20a7d5dbdfdf2f0300e0d017e35
parent373bc005abe40851c372ba1d0c5a2d3082a72a72 (diff)
some more tanslated
-rw-r--r--es-es/scala.html.markdown17
1 files 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