General Usage Rules In America, Canada, Australia and New Zealand, the general rule is that double quotes are used to denote direct speech. Single quotes are used to enclose a quote within a quote, a quote within a headline, or a title within a quote.
Double quotation marks (in British English) are used to indicate direct speech within direct speech (use single inverted commas for direct speech and double quotation marks to enclose quoted material within).
Single quotation marks are also known as 'quote marks', 'quotes', 'speech marks' or 'inverted commas'. Use them to: show direct speech and the quoted work of other writers. enclose the title of certain works.
But I bet you're curious about how they're different, why else would you be here? The main difference between the two is: Quotation marks are used to report speech. An apostrophe is used for making contractions and possession.
a += b
is short-hand for a = a + b
(though note that the expression a
will only be evaluated once.)
a =+ b
is a = (+b)
, i.e. assigning the unary +
of b
to a
.
Examples:
int a = 15;
int b = -5;
a += b; // a is now 10
a =+ b; // a is now -5
+=
is a compound assignment operator - it adds the RHS operand to the existing value of the LHS operand.
=+
is just the assignment operator followed by the unary + operator. It sets the value of the LHS operand to the value of the RHS operand:
int x = 10;
x += 10; // x = x + 10; i.e. x = 20
x =+ 5; // Equivalent to x = +5, so x = 5.
+=
→ Add the right side to the left
=+
→ Don't use this. Set the left to the right side.
a += b
equals a = a + b
. a =+ b
equals a = (+b)
.
x += y
is the same as
x = x + y
and
x =+ y
is wrong but could be interpreted as
x = 0 + y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With