There is a sentence about "statement" that I can't understand in C Primer Plus by Stephen Prata.  In Chapter 5, there is a section which explains difference between statement and expression. The author explains statement as follows:      Statements       Statements are the primary building blocks of a program. A program is a series of statements with some necessary punctuation. A statement is   a complete instruction to the computer. In C, statements are indicated   by a semicolon at the end. Therefore,        legs = 4   is just an expression (which could be part of a larger expression), but    legs = 4;      is a statement.   And then the author gives an example:      Although a statement (or, at least, a sensible statement) is a complete instruction, not all complete instructions are statements.   Consider the following statement:        x = 6 + (y = 5);      In it, the subexpression y = 5 is a complete instruction, but it is only part of the statement. Because a complete instruction is not   necessarily a statement, a semicolon is needed to identify   instructions that truly are statements.   The authors says that "y=5"is a complete instruction but as she mentioned above isn't this just an expression, not a complete statement?
78505
I'm asking with regards to c#, but I assume its the same in most other languages.  Does anyone have a good definition of expressions and statements and what the differences are?
75087
Call me nitpicky, but I can't ignore the fact that the emphasis on the following close reason is misleading:     Questions asking for code must demonstrate a minimal understanding   of the problem being solved. Include attempted solutions, why they   didn't work, and the expected results. See also:    (Emphasis not mine)   The main emphasis is about what they did wrong, rather than how to fix it!       demonstrate a minimal understanding of the problem being solved   So the OP thinks     What does that supposed to mean? I know what my problem is!   Instead, the emphasis should be on Include attempted solutions, why they didn't work, and the expected results Also, the emphasis is set on the expected results, rather than what's usually missing from the question, the attempted solutions.     I suggest the following emphasis:     Questions asking for code must demonstrate a minimal understanding   of the problem being solved. Include attempted solutions, why they   didn't work, and the expected results. See also:
610
I've always wondered how to write the "A ? B : C" syntax in a C++ compatible language.  I think it works something like: (Pseudo code)  If A &gt; B    C = A Else    C = B   Will any veteran C++ programmer please help me out?
13804
I hope this qualifies as a programming question, as in any programming tutorial, you eventually come across 'foo' in the code examples. (yeah, right?)  what does 'foo' really mean?  If it is meant to mean nothing, when did it begin to be used so?
103362
I do not understand the difference between $\rightarrow$ and $\Rightarrow$. Sometimes I see implication truth tables labeled with the former, sometimes with the latter.  Aren't they synonyms of logical implication or is there any difference?
116659
In a  I am reading, the section on Propositional Logic says that a proposition is a statement that is either true or false, but not both true and false. Also, from  lecture online, the instructor says that we must be able to associate a truth value to a proposition.    The text I mentioned contains as an example of an assertion that is not a proposition the following:    (1) "this statement is false."    In the margin, the text says that the form of this statement makes it impossible to designate a truth value to it and the instructor in the lecture says simply that, "if [the statement] is true, then it is false, and if it is false, then it is true."    However, why exactly is it impossible to for (1) to have a truth value? What does it mean to say that if (1) is true, it is false, and conversely?    Response to Asaf Karagila As has been pointed out, I have already asked this question very recently  but it has not received proper attention. This question is one that I feel can be put to rest if only someone would provide an explanation that is direct and suitable for my level, which is that of a novice.
60347
My book and my teacher both said that these two statements are different:  1) $∀x∈A,∃y∈B, F(x, y)⇒G(x)$  2) $∀x∈A,(∃y∈B, F(x, y))⇒G(x)$  How can just adding an extra parenthesis make the statement different? I am not quite sure I understand.  If they are different, how are there negation different? Would the negation be as follows:  1) $∀x∈A,∃y∈B, F(x, y) ∧ ¬ G(x)$  2) $∀x∈A,(∀y∈B, ¬ F(x, y)) ∧ ¬ G(x)$    SIDE NOTE: I tried taking contrapositives, but ended up with the same expression for both. So how and why are they diffrent? $¬ G(x) ⇒ ∃x∈A,∀y∈B, ¬ F(x, y) $    Thanks
8188
Just looking at:   (Source: )  What does this SQL do:  Robert'); DROP TABLE STUDENTS; --   I know both ' and -- are for comments, but doesn't the word DROP get commented as well since it is part of the same line?
17837
I studied propositional logic, and everyday I see applications of what I learned on the internet, in mathematical books and miscelaneous resources.        One particular case is sentences in the form $a \rightarrow b$ , that is, material implications. While I fully understand the mathematical logic approach to the study of those kinds of formulas, sometimes I get confused about what someone ( using implication sentences in the ordinary language ) is trying to say.        In ordinary language, I often see affirmations in the form of an implication.  One example would be someone affirming that "the moon is made of cheese" $\rightarrow 2+2=4$. [ Kleene, Mathematical Logic ].      I perfectly understand that if we choose the interpretation that gives the antecedent as false ( and the consequent as true ) we get that the whole implication is also true, but I would like to understand EXACTLY what he is trying to say when he AFFIRMS a sentence in the form of an implication. Is he saying that under the commonly agreed interpretation of that sentence ( antecedent = false, consequent = true ), that implication becomes true?      Another example, totally different, would be someone affirming that $x \in \mathbb{N} \rightarrow x \in \mathbb{N}$ or $x \in \mathbb{Z}_{&lt;0}$. Is he now affirming the same kind of sentence or saying something totally different?      When he affirms that sentence, is he saying that he finds the sentence to be a tautology?   Why didn't he say that?          Then, with these two examples we have an affirmation of the same kind of sentence (implication) meaning completely different things, in one case he affirms to say that under the commonly agreed interpretation of the sentence, it is true. In another case, he affirms to say that there's no interpretation that makes the sentence false.       Am I missing something? There is really that ambiguity in ordinary language, when people are affirming sentences?  Can't I just take some general instance of the affirmation of a sentence in the form $a \rightarrow b$ in ordinary language and know exactly what he's trying to say, regardless of the propositions he chooses the substitute $a$ and $b$ for?       Thanks a bunch.
5100
Provided we have this truth table where "$p\implies q$" means "if $p$ then $q$":  $$\begin{array}{|c|c|c|} \hline p&amp;q&amp;p\implies q\\ \hline T&amp;T&amp;T\\ T&amp;F&amp;F\\ F&amp;T&amp;T\\ F&amp;F&amp;T\\\hline \end{array}$$  My understanding is that "$p\implies q$" means "when there is $p$, there is q". The second row in the truth table where $p$ is true and $q$ is false would then contradict "$p\implies q$" because there is no $q$ when $p$ is present.  Why then, does the third row of the truth table not contradict "$p\implies q$"? If $q$ is true when $p$ is false, then $p$ is not a condition of $q$.  I have not taken any logic class so please explain it in layman's terms.       Administrative note. You may experience being directed here even though your question was actually about line 4 of the truth table instead. In that case, see the companion question  And even if your original worry was about line 3, it might be useful to skim the other question anyway; many of the answers to either question attempt to explain both lines.
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?
13053
Why do most C programmers name variables like this:  int *myVariable;   rather than like this:  int* myVariable;   Both are valid. It seems to me that the asterisk is a part of the type, not a part of the variable name. Can anyone explain this logic?
102950
I am reading introductory texts on logic and am having a hard time understanding intuitively logical implication.  Specifically, I am wondering if logical implication can always be determined by two statements, P and Q alone? I'll try to give an example to clarify my question.  For example if the statement P is $x = 2$, and the statement Q is $x^2 &lt; 6$, then determining the truth of P $\Rightarrow$ Q is fairly straightforward:   If $x$ does equal 2, then $4&lt;6$ and Q is true, so $P \Rightarrow Q$ is true. And if $x$ does not equal 2, $P \Rightarrow Q$ is vacuously true.  In this example, with two statements P and Q, I can evaluate the truth/falsity of the statement P implies Q. However, what if the statement Q is changed such that it is now the statement $y = 5$?  So now I am trying to prove from that $$x = 2 \Rightarrow y = 5$$  Here is where things get murky for me. Say $x$ is not equal to 2, then $P \Rightarrow Q$ is vacuously true. But what about when $x$ does equal 2, now the statement Q could be true, but it could also be false, depending on some 'context'.   For example, if I said at the start: "Here are two statements, P and Q. Know that x = 2 and y = 4." Given this 'context', $P \Rightarrow Q$ is false. But if I say "Here are two statements, P and Q. Know that x = 2 and y = 5", then now $P \Rightarrow Q$ is true.  My discomfort here is that I assumed with two statements P and Q, I can determine the truth/falsity of $P \Rightarrow Q$ with just this information. Is this the wrong assumption?  As a secondary question, how can the truthfulness of the statement $P \Rightarrow Q$ be variable, depending on context? I have read on some other questions that implication can be interpreted as a promise. So how could it be that depending on some context the promise is sometimes true but sometimes false? Wouldn't this actually mean the promise is not always consistent and is therefore always false?  Some further information in case it is relevant, I recognise that in the first example, the statement Q is 'dependent' in some way on the statement P, since the object under examination in both statements is $x$, whereas in the second example there are two different objects which I am trying to make a logical connection between, which I am thinking may not be valid for some reason. I also recognise that there is still 'context' in the first example, in that we need information on whether $x$ is equal to 2 or not, however in that case it doesn't matter, since $P \Rightarrow Q$ is always true anyway.  Thanks very much in advance.
30009
In , I asked about proof of statements which are simple but incorrect.   Here, I ask about statements which seems, at a first glance, straightforward, but if we try to write a proof, we can see it's much harder than it looked. So I expect the answers to contain:   the statement; why it looks easy to prove; why actually it isn't.
17138
Definition: Theorem, Lemma, Proposition, Corollary, Postulate, Statement, Fact, Observation, Expression, Fact, Property, Conjecture and Principle   Most of the time a mathematical statement is classified with one the words listed above.  However, I can't seem to find definitions of them all online, so I will request your aid in describe/define them.  Also, when is a mathematical statement a theorem versus a lemma ? I've read that a theorem is important while a lemma is not so important and used to prove a theorem. However a theorem is sometimes used to prove some other theorem. This implies that some theorems are also lemmas ?  Is it subjective with respect to the author, which statements become a theorem, lemma, etc. ?
44048
I'm working on a C-brain teaser:  Write the standard Hello-World program, without semi-colons.  My best answer so far is:  int main(void) {     if (printf("Hello World!\n"), exit(0), 0)     {         /* do nothing */     } }   But I don't understand why I don't get compiler error (Visual Studio):  error C4716: 'main' : must return a value   I've tried other functions with a return-type declared, but missing a return-statement, and get this compiler error.    Note that I've also tried:  int foo(void) {     if (printf("Hello World!\n"), exit(0), true)     {         /* do nothing */     } }  int main(void) {     foo(); }   And don't get a compiler error on foo.  If I remove the "exit(0)", I do get the compiler error.  Apparently the compiler has knowledge that "exit" is a special function?  This seems very odd to me.
62177
How is the statement $\bot \to \top$ true? If, for example, I take the statement  $P = 2$ is an odd number $Q = 5$ is an odd number Then $P$ is false and $Q$ is true.  Clearly, false implies true translates to  if $2$ is an odd number then 5 is an odd number  which means that  if $2$ is not an odd number (i.e. even) then $5$ is not an odd number  which is clearly false as $2$ is indeed an even number. Please help me to find what I’m missing out in this. Thanks for your help!