none
as we have "&&" for "AND" how can I denote "ANDLSO" RRS feed

  • Question

  • hi,

    as we have "&&" for "AND"  how can I denote "ANDLSO"

    is there anything for andalso?

    in dot net. 

    Thursday, February 21, 2008 9:02 AM

Answers

  •  keval Raj wrote:

    thank u

    but

    r u sure about this ?Vitaliy

     

    Assuming you are speaking of C#, and you should have posted the question there, there are some ways to make sure.

     

    One simple way is to run a simple test:

     

    Code Snippet

    public bool HelloWorld() {

    Console.WriteLine("Hello World!");

    return false;

    }

     

    // Hello World will be wrote once and only once.

    public void TestAnd() {

    bool result = HelloWorld() && HelloWorld();

    }

     

     

    Another way is to search inside c# documentation.

    Thursday, February 21, 2008 12:03 PM
  •  

    & = And (bitwise & non-short-circuiting 'and')

    | = Or (bitwise & non-short-circuiting 'or')

    && = AndAlso

    || = OrElse

     

    Thursday, February 21, 2008 3:32 PM
  • All replies

    • Hi,

       

      Actually, operator "&&" in C# behaves like ANDALSO but not like AND.

      In other words, if you have expression:

      a > b && b > c

      then if first experssion is false, then second expression is not evaluated, and result is false.

       

      Thursday, February 21, 2008 9:31 AM
    • thank u

      but

      r u sure about this ?Vitaliy
      Thursday, February 21, 2008 9:40 AM
    •  keval Raj wrote:

      thank u

      but

      r u sure about this ?Vitaliy

       

      Assuming you are speaking of C#, and you should have posted the question there, there are some ways to make sure.

       

      One simple way is to run a simple test:

       

      Code Snippet

      public bool HelloWorld() {

      Console.WriteLine("Hello World!");

      return false;

      }

       

      // Hello World will be wrote once and only once.

      public void TestAnd() {

      bool result = HelloWorld() && HelloWorld();

      }

       

       

      Another way is to search inside c# documentation.

      Thursday, February 21, 2008 12:03 PM
  •  

    & = And (bitwise & non-short-circuiting 'and')

    | = Or (bitwise & non-short-circuiting 'or')

    && = AndAlso

    || = OrElse

     

    Thursday, February 21, 2008 3:32 PM


  • thank u very much for your solution 
    Wednesday, February 27, 2008 3:37 PM