summaryrefslogtreecommitdiffhomepage
path: root/pt-br
diff options
context:
space:
mode:
authorMarcel Ribeiro Dantas, Ph.D <ribeirodantasdm@gmail.com>2022-07-07 14:52:40 +0200
committerGitHub <noreply@github.com>2022-07-07 14:52:40 +0200
commit94c9dea6962e973c8cdcb6da56ce4ab710ef7702 (patch)
treec377b5f6ac7c7c216753e0f39ec1b711fd018a2f /pt-br
parent4bbbdf09a04c5d54590ba067fa6dc11eeefbdc2e (diff)
Update groovy-pt.html.markdown
Update Portuguese version to the original version in English
Diffstat (limited to 'pt-br')
-rw-r--r--pt-br/groovy-pt.html.markdown12
1 files changed, 10 insertions, 2 deletions
diff --git a/pt-br/groovy-pt.html.markdown b/pt-br/groovy-pt.html.markdown
index 3acfce21..3bd1ddfc 100644
--- a/pt-br/groovy-pt.html.markdown
+++ b/pt-br/groovy-pt.html.markdown
@@ -201,8 +201,16 @@ if(x==1) {
//Groovy também suporta o operador ternário
def y = 10
-def x = (y > 1) ? "functionou" : "falhou"
-assert x == "functionou"
+def x = (y > 1) ? "funcionou" : "falhou"
+assert x == "funcionou"
+
+//E suporta o 'The Elvis Operator' também!
+//Em vez de usar o operador ternário:
+
+displayName = nome.name ? nome.name : 'Anonimo'
+
+//Podemos escrever:
+displayName = nome.name ?: 'Anonimo'
//Loop 'for'
//Itera sobre um intervalo (range)