Created
August 7, 2013 14:55
-
-
Save Fhernd/6174775 to your computer and use it in GitHub Desktop.
Demostración del uso de variables booleanos en estructuras de control decisivas.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ConversionBooleanos | |
{ | |
static void Main() | |
{ | |
// declaración de variable entera de 32 bits | |
int x = 123; | |
// if (x) // Error: "Cannot implicitly convert type 'int' to 'bool'" | |
{ | |
Console.WriteLine( "El valor de la variable 'x' es distinto de cero."); | |
} | |
if (x != 0) | |
{ | |
Console.WriteLine( "El valor de la variable 'x' es distinto de cero."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment