What will be printed out as a result of the following code execution:
 
class Program
{ 
    static bool SomeMethod()
    { 
        Console.WriteLine("Method was invoked"); 
        return true;
     } 
     static void Main(string[] args) 
     {
          if (true & false & SomeMethod()) 
          { 
               Console.WriteLine("Inside IF operator"); 
           } 
       } 
  }
 
Explanation
& operation inside of an IF statement allows to fully evaluate a condition independently of its operands, even if it is obvious that the result does not depend on the subsequent operands. This operation differs from the && operation in that it evaluates the expression entirely.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты