PergResp71

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		Teste1();
		Teste2();
	}
	
	static void Teste1()
	{
		int a = 1;  
        int b = 2;  

		if (a < 0  && b > 0)  
        {
          Console.WriteLine("Entrou...");
        }
		
		Console.WriteLine("Usando o operador && se uma condição for false não avalia a segunda");
	}
	
	static void Teste2()
	{
		int a = 1;  
        int b = 2;  

		if (a < 0 & b > 0)  
        {
          Console.WriteLine("Entrou...");
        }
		
		Console.WriteLine("Usando o operador & sempre avalia as duas expressões");
	}
}
;