Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created August 7, 2013 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/6174775 to your computer and use it in GitHub Desktop.
Save Fhernd/6174775 to your computer and use it in GitHub Desktop.
Demostración del uso de variables booleanos en estructuras de control decisivas.
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