if statement
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Ejecuta de forma condicional código .
Original:
Conditionally executes code.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Se utiliza cuando el código debe ser ejecutada sólo si una condición está presente .
Original:
Used where code needs to be executed only if some condition is present.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Contenido |
[editar] Sintaxis
if ( expression ) statement_true
|
|||||||||
if ( expression ) statement_true else statement_false
|
|||||||||
[editar] Explicación
expression deberá ser una expresión, convertible a bool .
Original:
expression shall be an expression, convertible to bool.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Si se evalúa como true, se pasa el control a statement_true, statement_false (si está presente) no se ejecuta .
Original:
If it evaluates to true, control is passed to statement_true, statement_false (if present) is not executed.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
De lo contrario, el control pasa a statement_false, statement_true no se ejecuta .
Original:
Otherwise, control is passed to statement_false, statement_true is not executed.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Palabras clave
[editar] Ejemplo
El siguiente ejemplo muestra varios casos de uso de la declaración
if
Original:
The following example demonstrates several usage cases of the
if statement
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Output:
first is false i == 3 i != 3 is false