I was in my computer science class today, and the prof was talking about logical operations when he came about using the & and && operators. He said that we should only use && in cases where we specifically do not want the right hand operand to be evaluated, and use & all other times. In high school I was taught to do just the opposite, since && would be quicker in some cases. Makes sense to me to use && most of the time.
So, what is the proper usage? && most of the time, & in certain occasions, or vice versa? Is my prof a bad programmer, or did high school lead me down the wrong path? Does it really matter? Help!
BTW, this also applies to | and ||.
So, what is the proper usage? && most of the time, & in certain occasions, or vice versa? Is my prof a bad programmer, or did high school lead me down the wrong path? Does it really matter? Help!
BTW, this also applies to | and ||.