|
Field1 = 'BRYCE';
if Field1 = 'BRYCE';
is much nicer (I think) than
Field1 = 'BRYCE';
if (Field1 == 'BRYCE');
I *constantly* get tripped up in JavaScript (I don't code much C) using
'='
when I should be using '=='...
Agreed. But there's a reason for the syntax, and that is that assignment
can be done anywhere - even in an equality test.
For example (in C) if (a = 3) will always be true and a will always equal 3
at that point, because what's really being said is:
a = 3
if (a)
Hence the need for different operators. This feature is highly exploited
in
statements like:
if ((fp=fopen(szFilename, "r")) == NULL) { // handle error...
The above assigns the result of fopen to fp... and then tests fp against a
value of NULL.
The equivalent doesn't exist in RPG, which is precisely the reason RPG
doesn't have/need an assignment symbol that's different from the equality
test symbol. And the reason those other languages do.
Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"Few things are harder to put up with than the annoyance of a good
example."
-- Mark Twain
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.