× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Dennis.


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777



"Dennis Lovelady" <iseries@xxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
03/03/2010 02:26 PM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
"'RPG programming on the IBM i / System i'" <rpg400-l@xxxxxxxxxxxx>
cc

Subject
RE: More on RPG style






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 thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.