CAN YOU PLEASE EXPLAIN IN DETAIL. Why are we not checking both condition in &quot;and&quot; of if statement , and in checking both condition in &quot;or&quot; of If condition? Why in first question x= 11, y=20, is printed. While in second question x=11, y=21, is printed.
32740
Does the ANSI standard mandate the logical operators to be short-circuited, in either C or C++?  I'm confused for I recall the K&amp;R book saying your code shouldn't depend on these operations being short circuited, for they may not. Could someone please point out where in the standard it's said logic ops are always short-circuited? I'm mostly interested on C++, an answer also for C would be great.  I also remember reading (can't remember where) that evaluation order isn't strictly defined, so your code shouldn't depend or assume functions within an expression would be executed in a specific order: by the end of a statement all referenced functions will have been called, but the compiler has freedom in selecting the most efficient order.  Does the standard indicate the evaluation order of this expression?  if( functionA() &amp;&amp; functionB() &amp;&amp; functionC() ) cout&lt;&lt;"Hello world";
40162
Please demonstrate how the ternary operator works with a regular if/else block. Example:  Boolean isValueBig = value &gt; 100 ? true : false;     Exact Duplicate:
47722
I need to prove the following statement: if $xy=0$   then  $x=0$ $or$ $y=0$.  My first idea was to prove the negation of the original problem if $x\neq0$ and $y\neq0$ then $xy\neq0$ but I still don't know how to prove it rigorously.
17016
The following  code is supposed to compare two strings or variables. But, I cannot do it. Here, output doesn't depend upon the changing of inputs. Can anyone correct this code?    #!/bin/sh   echo "Enter your username1:"   read username1   echo "Enter your username2:"   read useraname2   if [ "$username1"=="$username2" ]   then   echo 'Same'   else   echo 'Different'   fi
47989
Okay, we know that the following two lines are equivalent -    (0 == i) (i == 0)   Also, the first method was encouraged in the past because that would have allowed the compiler to give an error message if you accidentally used '=' instead of '=='.  My question is - in today's generation of pretty slick IDE's and intelligent compilers, do you still recommend the first method?    In particular, this question popped into my mind when I saw the following code -   if(DialogResult.OK == MessageBox.Show("Message")) ...    In my opinion, I would never recommend the above. Any second opinions?
82893
Is it true that I cannot have OR or AND operators in if statements in APEX?  I have an object that has a picklist Code__c, and I need to execute some code if the code is set to either A or B.  How would I write something like:  if(pc.Code__c = 'A' || pc.Code__c = 'A') { }   Tia.
28448
Here is my proof, I would appreciate it if someone could critique it for me:  To prove this statement true, we must proof that the two conditional statements ("If $\mathcal{P}(A)⊆ \mathcal{P}(B)$, then $A⊆B$," and, If $A⊆B$, then $\mathcal{P}(A)⊆ \mathcal{P}(B)$) are true.    Contrapositive of the first statement: If $A \nsubseteq B$, then $\mathcal{P}(A) \nsubseteq \mathcal{P}(B)$  If $A \nsubseteq B$, then there must be some element in $A$, call it $x$, that is not in $B$: $x \in A$, and $x \notin B$. Since $x \in A$, then $\{x\} \in \mathcal{P}(A)$; moreover, since $x \notin B$, then $\{x\} \notin \mathcal{P}(B)$, which proves that, if $A \nsubseteq B$, then $\mathcal{P}(A) \nsubseteq \mathcal{P}(B)$. By proving the contrapositive true, the original proposition must be true.    To prove the second statement true, I would implement nearly the same argument, so that isn't necessary to write. So, does this proof seem correct? Also, was the contrapositive necessary? Or is there another way to prove the initial statement?
111444
If $\{x,\{x,y\}\} = \{z, \{z,t\}\}$, then must it be $x = z$ and $y = t$?   Can you explain, or can you give hint?
111297
I can't understand difference between $\varnothing$ and $\{\varnothing\}$. What is difference between $x$ and set that has only $x$ as element? I think the concept of set is meaningful when it has more than 1 element. If "$\varnothing$ and $\{\varnothing \}$ is different" is right, then I have another question. When we see the set $\{\varnothing,\{\varnothing\}\}, \varnothing$ and $\{\varnothing\}$ exist simultaneously. It means two empty sets exist. One empty set exists as $\varnothing$ itself and one empty set exists as element of $\{\varnothing\}$. I can't understand this situation. What am i misunderstanding?
4066
Are the following two boolean expressions the same?  if [ -n $1 ] ; then  if [ -n "$1" ] ; then   If not - When should you put a variable in quotes?
2525
My  has failed me.  In Python, are the following two tests for equality equivalent?  n = 5 # Test one. if n == 5:     print 'Yay!'  # Test two. if n is 5:     print 'Yay!'   Does this hold true for objects where you would be comparing instances (a list say)?  Okay, so this kind of answers my question:  L = [] L.append(1) if L == [1]:     print 'Yay!' # Holds true, but...  if L is [1]:     print 'Yay!' # Doesn't.   So == tests value where is tests to see if they are the same object?
72926
Hello I am taking a Discrete Mathematics course and having some trouble with this question about sets:  Under what conditions is $A- B = B- A$  Diagram:   Diagram:   Maybe I'm understanding incorrectly, but how can A-B and B-A be equal if they contain elements that are not in each other?
17902
Which is the simplest way to check if two integers have same sign? Is there any short bitwise trick to do this?
95629
I have a question that has been bothering me for quite some time. In second order logic sometimes there is an indication that a variable can be both bound and free. The simplest example I can give is using the variable $v_0$ and the constants $c_0, c_1$ who are not equal to one another. How does one interpret the following formula. $$(v_0=c_0)\wedge \left[ \exists v_0 (v_0 = c_1)\right]$$  I see a few possible interpretations:   The statement is not actually valid because variables cannot be both bound and free. The formula will always be false because $(v_0=c_0)$ restricts $v_0$ such that there cannot exist a $v_0=c_1$ The formula is true when $v_0=c_0$ because one essentially treats the free version of a variable differently from the bound version such that even though $v_0=c_0$ in this particular instance, it still theoretically could be that a variable $v_0$ equals the constant $c_1$ and thus the existence clause is satisfied as well.   I also recognize that it could be something completely different from any of these that I have not thought of yet, I was just curious if there was an accepted way to handle variables which are both free and bound because I have not found any satisfying answers as of yet.
7945
What is the difference between &gt;&gt; and &gt;&gt;&gt; in verilog/system verilog? I know that == tests for only 1 and 0, while === tests for 1, 0, X, Z. So how is that similar to the shift operator?
121379
What is the difference between  and ?
93154
I'm having problems with this; the strategy is to show the left side is in the right side, and vice versa. Thus far I can only show that both sides of the equality are in A\B. Can I use "the empty set = A and not A" as a fact? Because then it works. Or just show me how to do it!