problems on using the if and else statement and updating the data.
-
@JonB apparently part of the standard since c++98
https://en.cppreference.com/w/cpp/keyword/and -
@J-Hilk , @sierdzio
Absolutely shocking! I see from https://en.cppreference.com/w/cpp/language/operator_alternative that there are actually 11 new reserved words for operators. Includingnot
, and even the stringcompl
, which I might have used as variables and would break upgrading to C++ '98.Thinking aloud, I believe all C operators were symbols and not words, part of the charm (for right or for wrong) of the language.
With all due respect to @sierdzio's comment, which I accept & respect, I have still never seen a piece of C++ code using any of these.... [And hence would caution a beginner against adopting these.]
[C++ looks like it's trying to be a Python-wannabe ;-) ]
-
@JonB said in problems on using the if and else statement and updating the data.:
I have still never seen a piece of C++ code using any of these
Me neither :-)
-
I have seen it but very, very rarely.
And hence would caution a beginner against adopting these
I'm split on this :D One one hand,
&&
is clearly, vastly, totally the established and well-known convention practically everywhere. So using it is definitely a good idea.But on the other hand,
and
is more readable and convenient. So it is also a good idea. -
@sierdzio said in problems on using the if and else statement and updating the data.:
But on the other hand, and is more readable and convenient.
In Pascal or Python, yes. When scanning C/C++ I expect to see all operators as symbols (and not some but not others) Next C++ will be offering
begin
/end
for{
/}
! [Some people used to do all this words-for-symbols via C#define
s.] I give up on the modern world, it's all going to pot... ;-) -
@JonB said in problems on using the if and else statement and updating the data.:
Next C++ will be offering begin/end for {/}!
you can use
{ ??< } ??> [ ??( ] ??) # ??= \ ??/ ^ ??' | ??! ~ ??-
but that was removed in c++17, :)
-
but that was removed in c++17, :)
Even better --- you start using new language constructs and then they remove them so that your code gets broken!
FWIW, I note from https://en.cppreference.com/w/cpp/language/operator_alternative
There are alternative spellings for several operators and other tokens that use non-ISO646 characters.
So the motivation never was "clarity", it's to do with people having funny keyboards....
-
@JonB said in problems on using the if and else statement and updating the data.:
funny keyboards
The hardware is innocent ;-P
-
whats next, espousing the virtues of trigraphs?