The else statement isn't really necessary in Ruby as nil is returned anyway but it's added here for clarity.
La sentencia else no es estrictamente necesaria en Ruby, porque siempre se devuelve nil por defecto, pero se deja aquí por claridad.
As a rule, they are parsed starting from the most nested ifstatement, whereas each else statement is bound to the nearest available if on its left
Siguiendo la regla, se descomponen empezando por la sentencia if más anidada, mientras que cada sentencia else se enlaza a la más cercana sentencia if disponible a la izquierda.
The Else statement is optional; if you omit Else, execution continues with the first statement (if any) following the End if.
La instrucción Else es opcional; si omite Else, continua la ejecución con la primera instrucción (si la hay) después de End if.
The else statement is only executed if the if expression evaluated to FALSE, and if there were any elseif expressions - only if they evaluated to FALSE as well (see elseif).
La sentencia else se ejecuta solamente si la expresión if se evalúa como FALSE, y si hubiera alguna expresión elseif - solo si se evaluaron también a FALSE (Ver elseif).
If the Boolean expression is FALSE, the statements following the Else statement are executed.
Si la expresión booleana es FALSE, las instrucciones siguientes a la instrucción Else son ejecutadas.
This example does not use a false option, so the ELSE statement is deleted.
En este ejemplo no se va a crear una opción "falso", y por eso se borra la declaración ELSE.
You can filter your results with IF THEN ELSE by removing the ELSE statement.
Los resultados se pueden filtrar con IF THEN ELSE si se elimina la parte ELSE.
Conținut posibil inadecvat
Exemplele au rolul de a te ajuta să traduci cuvinte sau expresii corect si adaptat la context. Nu sunt selectate sau validate manual, așadar pot conține termeni inadecvați. Te rugăm să raportezi exemplele pe care le consideri inadecvate. Traducerile vulgare sau colocviale sunt în general marcate cu roșu sau cu portocaliu.
Înregistrează-te pentru a accesa mai multe exemple